+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; When we accept small parameters on Windows, make sure we do not assume they
; are zero or sign extended in memory or in registers.
; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefix=WIN64
; RUN: llc < %s -mtriple=x86_64-windows-gnu | FileCheck %s --check-prefix=WIN64
-; RUN: llc < %s -mtriple=i686-windows-msvc | FileCheck %s --check-prefix=WIN32
-; RUN: llc < %s -mtriple=i686-windows-gnu | FileCheck %s --check-prefix=WIN32
+; RUN: llc < %s -mtriple=i686-windows-msvc | FileCheck %s --check-prefix=WIN32-MSVC
+; RUN: llc < %s -mtriple=i686-windows-gnu | FileCheck %s --check-prefix=WIN32-GNU
define void @call() {
+; WIN64-LABEL: call:
+; WIN64: # %bb.0: # %entry
+; WIN64-NEXT: subq $56, %rsp
+; WIN64-NEXT: .seh_stackalloc 56
+; WIN64-NEXT: .seh_endprologue
+; WIN64-NEXT: movw $6, {{[0-9]+}}(%rsp)
+; WIN64-NEXT: movb $5, {{[0-9]+}}(%rsp)
+; WIN64-NEXT: movb $1, %cl
+; WIN64-NEXT: movw $2, %dx
+; WIN64-NEXT: movb $3, %r8b
+; WIN64-NEXT: movw $4, %r9w
+; WIN64-NEXT: callq manyargs
+; WIN64-NEXT: nop
+; WIN64-NEXT: addq $56, %rsp
+; WIN64-NEXT: retq
+; WIN64-NEXT: .seh_endproc
+;
+; WIN32-MSVC-LABEL: call:
+; WIN32-MSVC: # %bb.0: # %entry
+; WIN32-MSVC-NEXT: pushl $6
+; WIN32-MSVC-NEXT: pushl $5
+; WIN32-MSVC-NEXT: pushl $4
+; WIN32-MSVC-NEXT: pushl $3
+; WIN32-MSVC-NEXT: pushl $2
+; WIN32-MSVC-NEXT: pushl $1
+; WIN32-MSVC-NEXT: calll _manyargs
+; WIN32-MSVC-NEXT: addl $24, %esp
+; WIN32-MSVC-NEXT: retl
+;
+; WIN32-GNU-LABEL: call:
+; WIN32-GNU: # %bb.0: # %entry
+; WIN32-GNU-NEXT: pushl $6
+; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
+; WIN32-GNU-NEXT: pushl $5
+; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
+; WIN32-GNU-NEXT: pushl $4
+; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
+; WIN32-GNU-NEXT: pushl $3
+; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
+; WIN32-GNU-NEXT: pushl $2
+; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
+; WIN32-GNU-NEXT: pushl $1
+; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
+; WIN32-GNU-NEXT: calll _manyargs
+; WIN32-GNU-NEXT: addl $24, %esp
+; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset -24
+; WIN32-GNU-NEXT: retl
entry:
%rv = call i32 @manyargs(i8 1, i16 2, i8 3, i16 4, i8 5, i16 6)
ret void
}
define i32 @manyargs(i8 %a, i16 %b, i8 %c, i16 %d, i8 %e, i16 %f) {
+; WIN64-LABEL: manyargs:
+; WIN64: # %bb.0: # %entry
+; WIN64-NEXT: movzwl {{[0-9]+}}(%rsp), %r10d
+; WIN64-NEXT: movzbl {{[0-9]+}}(%rsp), %r11d
+; WIN64-NEXT: movsbl %cl, %ecx
+; WIN64-NEXT: movswl %dx, %eax
+; WIN64-NEXT: movzbl %r8b, %edx
+; WIN64-NEXT: addl %eax, %edx
+; WIN64-NEXT: movzwl %r9w, %eax
+; WIN64-NEXT: addl %edx, %eax
+; WIN64-NEXT: addl %r11d, %eax
+; WIN64-NEXT: addl %r10d, %eax
+; WIN64-NEXT: addl %ecx, %eax
+; WIN64-NEXT: retq
+;
+; WIN32-MSVC-LABEL: manyargs:
+; WIN32-MSVC: # %bb.0: # %entry
+; WIN32-MSVC-NEXT: pushl %edi
+; WIN32-MSVC-NEXT: pushl %esi
+; WIN32-MSVC-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; WIN32-MSVC-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
+; WIN32-MSVC-NEXT: movzwl {{[0-9]+}}(%esp), %edx
+; WIN32-MSVC-NEXT: movzbl {{[0-9]+}}(%esp), %esi
+; WIN32-MSVC-NEXT: movswl {{[0-9]+}}(%esp), %edi
+; WIN32-MSVC-NEXT: addl %esi, %edi
+; WIN32-MSVC-NEXT: addl %edx, %edi
+; WIN32-MSVC-NEXT: addl %ecx, %edi
+; WIN32-MSVC-NEXT: addl %eax, %edi
+; WIN32-MSVC-NEXT: movsbl {{[0-9]+}}(%esp), %eax
+; WIN32-MSVC-NEXT: addl %edi, %eax
+; WIN32-MSVC-NEXT: popl %esi
+; WIN32-MSVC-NEXT: popl %edi
+; WIN32-MSVC-NEXT: retl
+;
+; WIN32-GNU-LABEL: manyargs:
+; WIN32-GNU: # %bb.0: # %entry
+; WIN32-GNU-NEXT: pushl %edi
+; WIN32-GNU-NEXT: .cfi_def_cfa_offset 8
+; WIN32-GNU-NEXT: pushl %esi
+; WIN32-GNU-NEXT: .cfi_def_cfa_offset 12
+; WIN32-GNU-NEXT: .cfi_offset %esi, -12
+; WIN32-GNU-NEXT: .cfi_offset %edi, -8
+; WIN32-GNU-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; WIN32-GNU-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
+; WIN32-GNU-NEXT: movzwl {{[0-9]+}}(%esp), %edx
+; WIN32-GNU-NEXT: movzbl {{[0-9]+}}(%esp), %esi
+; WIN32-GNU-NEXT: movswl {{[0-9]+}}(%esp), %edi
+; WIN32-GNU-NEXT: addl %esi, %edi
+; WIN32-GNU-NEXT: addl %edx, %edi
+; WIN32-GNU-NEXT: addl %ecx, %edi
+; WIN32-GNU-NEXT: addl %eax, %edi
+; WIN32-GNU-NEXT: movsbl {{[0-9]+}}(%esp), %eax
+; WIN32-GNU-NEXT: addl %edi, %eax
+; WIN32-GNU-NEXT: popl %esi
+; WIN32-GNU-NEXT: popl %edi
+; WIN32-GNU-NEXT: retl
entry:
%aa = sext i8 %a to i32
%bb = sext i16 %b to i32
%t4 = add i32 %t3, %ff
ret i32 %t4
}
-
-; WIN64-LABEL: call:
-; WIN64-DAG: movw $6, 40(%rsp)
-; WIN64-DAG: movb $5, 32(%rsp)
-; WIN64-DAG: movb $1, %cl
-; WIN64-DAG: movw $2, %dx
-; WIN64-DAG: movb $3, %r8b
-; WIN64-DAG: movw $4, %r9w
-; WIN64: callq manyargs
-
-; WIN64-LABEL: manyargs:
-; WIN64-DAG: movsbl %cl,
-; WIN64-DAG: movswl %dx,
-; WIN64-DAG: movzbl %r8b,
-; WIN64-DAG: movzwl %r9w,
-; WIN64-DAG: movzbl 40(%rsp),
-; WIN64-DAG: movzwl 48(%rsp),
-; WIN64: retq
-
-
-; WIN32-LABEL: _call:
-; WIN32: pushl $6
-; WIN32: pushl $5
-; WIN32: pushl $4
-; WIN32: pushl $3
-; WIN32: pushl $2
-; WIN32: pushl $1
-; WIN32: calll _manyargs
-
-; WIN32-LABEL: _manyargs:
-; WIN32: pushl %edi
-; WIN32: pushl %esi
-; WIN32-DAG: movzwl 32(%esp),
-; WIN32-DAG: movzbl 28(%esp),
-; WIN32-DAG: movzwl 24(%esp),
-; WIN32-DAG: movzbl 20(%esp),
-; WIN32-DAG: movswl 16(%esp),
-; WIN32-DAG: movsbl 12(%esp),
-; WIN32: retl
-
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx512f | FileCheck %s --check-prefix=DARWIN
; RUN: llc < %s -mtriple=i686-pc-linux -mattr=+avx512f | FileCheck %s --check-prefix=LINUX
-; CHECK-LABEL: test_sse:
-; DARWIN: vpaddd %xmm3, %xmm2, %xmm2
-; DARWIN: vpaddd %xmm2, %xmm1, %xmm1
-; DARWIN: vpaddd %xmm1, %xmm0, %xmm0
-; LINUX: vpaddd {{[0-9]+}}(%e{{s|b}}p), %xmm2, %xmm2
-; LINUX: vpaddd %xmm2, %xmm1, %xmm1
-; LINUX: vpaddd %xmm1, %xmm0, %xmm0
define <4 x i32> @test_sse(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c, <4 x i32> %d) nounwind {
+; DARWIN-LABEL: test_sse:
+; DARWIN: ## %bb.0:
+; DARWIN-NEXT: vpaddd %xmm3, %xmm2, %xmm2
+; DARWIN-NEXT: vpaddd %xmm2, %xmm1, %xmm1
+; DARWIN-NEXT: vpaddd %xmm1, %xmm0, %xmm0
+; DARWIN-NEXT: retl
+;
+; LINUX-LABEL: test_sse:
+; LINUX: # %bb.0:
+; LINUX-NEXT: subl $12, %esp
+; LINUX-NEXT: vpaddd {{[0-9]+}}(%esp), %xmm2, %xmm2
+; LINUX-NEXT: vpaddd %xmm2, %xmm1, %xmm1
+; LINUX-NEXT: vpaddd %xmm1, %xmm0, %xmm0
+; LINUX-NEXT: addl $12, %esp
+; LINUX-NEXT: retl
%r0 = add <4 x i32> %a, %b
%r1 = add <4 x i32> %c, %d
%ret = add <4 x i32> %r0, %r1
ret <4 x i32> %ret
}
-; CHECK-LABEL: test_avx:
-; DARWIN: vpaddd %ymm3, %ymm2, %ymm2
-; DARWIN: vpaddd %ymm2, %ymm1, %ymm1
-; DARWIN: vpaddd %ymm1, %ymm0, %ymm0
-; LINUX: vpaddd {{[0-9]+}}(%e{{s|b}}p), %ymm2, %ymm2
-; LINUX: vpaddd %ymm2, %ymm1, %ymm1
-; LINUX: vpaddd %ymm1, %ymm0, %ymm0
define <8 x i32> @test_avx(<8 x i32> %a, <8 x i32> %b, <8 x i32> %c, <8 x i32> %d) nounwind {
+; DARWIN-LABEL: test_avx:
+; DARWIN: ## %bb.0:
+; DARWIN-NEXT: vpaddd %ymm3, %ymm2, %ymm2
+; DARWIN-NEXT: vpaddd %ymm2, %ymm1, %ymm1
+; DARWIN-NEXT: vpaddd %ymm1, %ymm0, %ymm0
+; DARWIN-NEXT: retl
+;
+; LINUX-LABEL: test_avx:
+; LINUX: # %bb.0:
+; LINUX-NEXT: pushl %ebp
+; LINUX-NEXT: movl %esp, %ebp
+; LINUX-NEXT: andl $-32, %esp
+; LINUX-NEXT: subl $32, %esp
+; LINUX-NEXT: vpaddd 8(%ebp), %ymm2, %ymm2
+; LINUX-NEXT: vpaddd %ymm2, %ymm1, %ymm1
+; LINUX-NEXT: vpaddd %ymm1, %ymm0, %ymm0
+; LINUX-NEXT: movl %ebp, %esp
+; LINUX-NEXT: popl %ebp
+; LINUX-NEXT: retl
%r0 = add <8 x i32> %a, %b
%r1 = add <8 x i32> %c, %d
%ret = add <8 x i32> %r0, %r1
ret <8 x i32> %ret
}
-; CHECK-LABEL: test_avx512:
-; DARWIN: vpaddd %zmm3, %zmm2, %zmm2
-; DARWIN: vpaddd %zmm2, %zmm1, %zmm1
-; DARWIN: vpaddd %zmm1, %zmm0, %zmm0
-; LINUX: vpaddd {{[0-9]+}}(%e{{s|b}}p), %zmm2, %zmm2
-; LINUX: vpaddd %zmm2, %zmm1, %zmm1
-; LINUX: vpaddd %zmm1, %zmm0, %zmm0
define <16 x i32> @test_avx512(<16 x i32> %a, <16 x i32> %b, <16 x i32> %c, <16 x i32> %d) nounwind {
+; DARWIN-LABEL: test_avx512:
+; DARWIN: ## %bb.0:
+; DARWIN-NEXT: vpaddd %zmm3, %zmm2, %zmm2
+; DARWIN-NEXT: vpaddd %zmm2, %zmm1, %zmm1
+; DARWIN-NEXT: vpaddd %zmm1, %zmm0, %zmm0
+; DARWIN-NEXT: retl
+;
+; LINUX-LABEL: test_avx512:
+; LINUX: # %bb.0:
+; LINUX-NEXT: pushl %ebp
+; LINUX-NEXT: movl %esp, %ebp
+; LINUX-NEXT: andl $-64, %esp
+; LINUX-NEXT: subl $64, %esp
+; LINUX-NEXT: vpaddd 8(%ebp), %zmm2, %zmm2
+; LINUX-NEXT: vpaddd %zmm2, %zmm1, %zmm1
+; LINUX-NEXT: vpaddd %zmm1, %zmm0, %zmm0
+; LINUX-NEXT: movl %ebp, %esp
+; LINUX-NEXT: popl %ebp
+; LINUX-NEXT: retl
%r0 = add <16 x i32> %a, %b
%r1 = add <16 x i32> %c, %d
%ret = add <16 x i32> %r0, %r1