; NOTE: Assertions have been autogenerated by update_test_checks.py
-; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=sse | FileCheck %s --check-prefix=ANY --check-prefix=SSE --check-prefix=SSE1
-; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=sse2 | FileCheck %s --check-prefix=ANY --check-prefix=SSE --check-prefix=SSE2
-; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=avx | FileCheck %s --check-prefix=ANY --check-prefix=AVX --check-prefix=AVX1
-; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=avx2 | FileCheck %s --check-prefix=ANY --check-prefix=AVX --check-prefix=AVX2
+; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=sse | FileCheck %s --check-prefix=SSE
+; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=sse2 | FileCheck %s --check-prefix=SSE
+; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=sse2,-slow-unaligned-mem-16 | FileCheck %s --check-prefix=SSE2FAST
+; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=avx | FileCheck %s --check-prefix=AVX --check-prefix=AVX1
+; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=avx2 | FileCheck %s --check-prefix=AVX --check-prefix=AVX2
; https://llvm.org/bugs/show_bug.cgi?id=27100
; SSE-NEXT: movq %rax, (%rdi)
; SSE-NEXT: retq
;
+; SSE2FAST-LABEL: memset_16_nonzero_bytes:
+; SSE2FAST: movaps {{.*#+}} xmm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
+; SSE2FAST-NEXT: movups %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX-LABEL: memset_16_nonzero_bytes:
; AVX: vmovaps {{.*#+}} xmm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
; AVX-NEXT: vmovups %xmm0, (%rdi)
; SSE-NEXT: movq %rax, (%rdi)
; SSE-NEXT: retq
;
+; SSE2FAST-LABEL: memset_32_nonzero_bytes:
+; SSE2FAST: movaps {{.*#+}} xmm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
+; SSE2FAST-NEXT: movups %xmm0, 16(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX-LABEL: memset_32_nonzero_bytes:
; AVX: vmovaps {{.*#+}} ymm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
; AVX-NEXT: vmovups %ymm0, (%rdi)
; SSE-NEXT: movq %rax, (%rdi)
; SSE-NEXT: retq
;
+; SSE2FAST-LABEL: memset_64_nonzero_bytes:
+; SSE2FAST: movaps {{.*#+}} xmm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
+; SSE2FAST-NEXT: movups %xmm0, 48(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 32(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 16(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX-LABEL: memset_64_nonzero_bytes:
; AVX: vmovaps {{.*#+}} ymm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
; AVX-NEXT: vmovups %ymm0, 32(%rdi)
; SSE-NEXT: movq %rax, (%rdi)
; SSE-NEXT: retq
;
+; SSE2FAST-LABEL: memset_128_nonzero_bytes:
+; SSE2FAST: movaps {{.*#+}} xmm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
+; SSE2FAST-NEXT: movups %xmm0, 112(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 96(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 80(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 64(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 48(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 32(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 16(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX-LABEL: memset_128_nonzero_bytes:
; AVX: vmovaps {{.*#+}} ymm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
; AVX-NEXT: vmovups %ymm0, 96(%rdi)
; SSE-NEXT: popq %rax
; SSE-NEXT: retq
;
+; SSE2FAST-LABEL: memset_256_nonzero_bytes:
+; SSE2FAST: movaps {{.*#+}} xmm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
+; SSE2FAST-NEXT: movups %xmm0, 240(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 224(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 208(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 192(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 176(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 160(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 144(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 128(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 112(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 96(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 80(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 64(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 48(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 32(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, 16(%rdi)
+; SSE2FAST-NEXT: movups %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX-LABEL: memset_256_nonzero_bytes:
; AVX: vmovaps {{.*#+}} ymm0 = [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42]
; AVX-NEXT: vmovups %ymm0, 224(%rdi)
; SSE-NEXT: movq %rcx, (%rdi)
; SSE-NEXT: retq
;
+; SSE2FAST-LABEL: memset_16_nonconst_bytes:
+; SSE2FAST: movd %esi, %xmm0
+; SSE2FAST-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; SSE2FAST-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7]
+; SSE2FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
+; SSE2FAST-NEXT: movdqu %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX1-LABEL: memset_16_nonconst_bytes:
; AVX1: vmovd %esi, %xmm0
; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
; SSE-NEXT: movq %rcx, (%rdi)
; SSE-NEXT: retq
;
+; SSE2FAST-LABEL: memset_32_nonconst_bytes:
+; SSE2FAST: movd %esi, %xmm0
+; SSE2FAST-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; SSE2FAST-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7]
+; SSE2FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
+; SSE2FAST-NEXT: movdqu %xmm0, 16(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX1-LABEL: memset_32_nonconst_bytes:
; AVX1: vmovd %esi, %xmm0
; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
; SSE-NEXT: movq %rcx, (%rdi)
; SSE-NEXT: retq
;
+; SSE2FAST-LABEL: memset_64_nonconst_bytes:
+; SSE2FAST: movd %esi, %xmm0
+; SSE2FAST-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; SSE2FAST-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7]
+; SSE2FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
+; SSE2FAST-NEXT: movdqu %xmm0, 48(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 32(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 16(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX1-LABEL: memset_64_nonconst_bytes:
; AVX1: vmovd %esi, %xmm0
; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
; SSE-NEXT: movq %rcx, (%rdi)
; SSE-NEXT: retq
;
+; SSE2FAST-LABEL: memset_128_nonconst_bytes:
+; SSE2FAST: movd %esi, %xmm0
+; SSE2FAST-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; SSE2FAST-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7]
+; SSE2FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
+; SSE2FAST-NEXT: movdqu %xmm0, 112(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 96(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 80(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 64(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 48(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 32(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 16(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX1-LABEL: memset_128_nonconst_bytes:
; AVX1: vmovd %esi, %xmm0
; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
; SSE: movl $256, %edx # imm = 0x100
; SSE-NEXT: jmp memset # TAILCALL
;
+; SSE2FAST-LABEL: memset_256_nonconst_bytes:
+; SSE2FAST: movd %esi, %xmm0
+; SSE2FAST-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; SSE2FAST-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7]
+; SSE2FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
+; SSE2FAST-NEXT: movdqu %xmm0, 240(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 224(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 208(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 192(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 176(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 160(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 144(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 128(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 112(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 96(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 80(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 64(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 48(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 32(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, 16(%rdi)
+; SSE2FAST-NEXT: movdqu %xmm0, (%rdi)
+; SSE2FAST-NEXT: retq
+;
; AVX1-LABEL: memset_256_nonconst_bytes:
; AVX1: vmovd %esi, %xmm0
; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1