2015-03-07 05:19:32 +08:00
|
|
|
; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx | FileCheck -check-prefix=X32 %s
|
|
|
|
; RUN: llc < %s -mtriple=i386-pc-win32 -mattr=+avx | FileCheck -check-prefix=X32 %s
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+avx | FileCheck -check-prefix=WIN64 %s
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx | FileCheck -check-prefix=X64 %s
|
2012-10-24 22:46:16 +08:00
|
|
|
|
|
|
|
declare <16 x float> @func_float16_ptr(<16 x float>, <16 x float> *)
|
|
|
|
declare <16 x float> @func_float16(<16 x float>, <16 x float>)
|
2012-11-20 17:37:57 +08:00
|
|
|
declare i32 @func_int(i32, i32)
|
|
|
|
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64-LABEL: testf16_inp
|
2012-10-24 22:46:16 +08:00
|
|
|
; WIN64: vaddps {{.*}}, {{%ymm[0-1]}}
|
|
|
|
; WIN64: vaddps {{.*}}, {{%ymm[0-1]}}
|
|
|
|
; WIN64: leaq {{.*}}(%rsp), %rcx
|
|
|
|
; WIN64: call
|
|
|
|
; WIN64: ret
|
|
|
|
|
2014-06-25 20:41:52 +08:00
|
|
|
; X32-LABEL: testf16_inp
|
2012-11-20 17:37:57 +08:00
|
|
|
; X32: movl %eax, (%esp)
|
|
|
|
; X32: vaddps {{.*}}, {{%ymm[0-1]}}
|
|
|
|
; X32: vaddps {{.*}}, {{%ymm[0-1]}}
|
|
|
|
; X32: call
|
|
|
|
; X32: ret
|
2012-10-24 22:46:16 +08:00
|
|
|
|
2014-06-25 20:41:52 +08:00
|
|
|
; X64-LABEL: testf16_inp
|
2012-11-20 17:37:57 +08:00
|
|
|
; X64: vaddps {{.*}}, {{%ymm[0-1]}}
|
|
|
|
; X64: vaddps {{.*}}, {{%ymm[0-1]}}
|
|
|
|
; X64: leaq {{.*}}(%rsp), %rdi
|
|
|
|
; X64: call
|
|
|
|
; X64: ret
|
2012-10-24 22:46:16 +08:00
|
|
|
|
|
|
|
;test calling conventions - input parameters
|
|
|
|
define <16 x float> @testf16_inp(<16 x float> %a, <16 x float> %b) nounwind {
|
|
|
|
%y = alloca <16 x float>, align 16
|
|
|
|
%x = fadd <16 x float> %a, %b
|
2013-10-16 07:33:07 +08:00
|
|
|
%1 = call intel_ocl_bicc <16 x float> @func_float16_ptr(<16 x float> %x, <16 x float>* %y)
|
2015-02-28 05:17:42 +08:00
|
|
|
%2 = load <16 x float>, <16 x float>* %y, align 16
|
2012-10-24 22:46:16 +08:00
|
|
|
%3 = fadd <16 x float> %2, %1
|
|
|
|
ret <16 x float> %3
|
|
|
|
}
|
|
|
|
|
|
|
|
;test calling conventions - preserved registers
|
|
|
|
|
|
|
|
; preserved ymm6-ymm15
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64-LABEL: testf16_regs
|
2012-10-24 22:46:16 +08:00
|
|
|
; WIN64: call
|
2013-10-16 07:33:07 +08:00
|
|
|
; WIN64: vaddps {{%ymm[6-7]}}, {{%ymm[0-1]}}, {{%ymm[0-1]}}
|
|
|
|
; WIN64: vaddps {{%ymm[6-7]}}, {{%ymm[0-1]}}, {{%ymm[0-1]}}
|
2012-10-24 22:46:16 +08:00
|
|
|
; WIN64: ret
|
|
|
|
|
|
|
|
; preserved ymm8-ymm15
|
2014-06-25 20:41:52 +08:00
|
|
|
; X64-LABEL: testf16_regs
|
2012-11-20 17:37:57 +08:00
|
|
|
; X64: call
|
2013-10-16 07:33:07 +08:00
|
|
|
; X64: vaddps {{%ymm[8-9]}}, {{%ymm[0-1]}}, {{%ymm[0-1]}}
|
|
|
|
; X64: vaddps {{%ymm[8-9]}}, {{%ymm[0-1]}}, {{%ymm[0-1]}}
|
2012-11-20 17:37:57 +08:00
|
|
|
; X64: ret
|
2012-10-24 22:46:16 +08:00
|
|
|
|
|
|
|
define <16 x float> @testf16_regs(<16 x float> %a, <16 x float> %b) nounwind {
|
|
|
|
%y = alloca <16 x float>, align 16
|
|
|
|
%x = fadd <16 x float> %a, %b
|
2013-10-16 07:33:07 +08:00
|
|
|
%1 = call intel_ocl_bicc <16 x float> @func_float16_ptr(<16 x float> %x, <16 x float>* %y)
|
2015-02-28 05:17:42 +08:00
|
|
|
%2 = load <16 x float>, <16 x float>* %y, align 16
|
2012-10-24 22:46:16 +08:00
|
|
|
%3 = fadd <16 x float> %1, %b
|
|
|
|
%4 = fadd <16 x float> %2, %3
|
|
|
|
ret <16 x float> %4
|
|
|
|
}
|
|
|
|
|
|
|
|
; test calling conventions - prolog and epilog
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64-LABEL: test_prolog_epilog
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
|
|
|
; WIN64: vmovaps {{%ymm([6-9]|1[0-5])}}, {{.*(%rbp).*}} # 32-byte Spill
|
2012-10-24 22:46:16 +08:00
|
|
|
; WIN64: call
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
; WIN64: vmovaps {{.*(%rbp).*}}, {{%ymm([6-9]|1[0-5])}} # 32-byte Reload
|
|
|
|
|
|
|
|
; X64-LABEL: test_prolog_epilog
|
2014-11-19 07:38:19 +08:00
|
|
|
; X64: vmovups {{%ymm([8-9]|1[0-5])}}, {{.*}}(%rsp) ## 32-byte Spill
|
|
|
|
; X64: vmovups {{%ymm([8-9]|1[0-5])}}, {{.*}}(%rsp) ## 32-byte Spill
|
|
|
|
; X64: vmovups {{%ymm([8-9]|1[0-5])}}, {{.*}}(%rsp) ## 32-byte Spill
|
|
|
|
; X64: vmovups {{%ymm([8-9]|1[0-5])}}, {{.*}}(%rsp) ## 32-byte Spill
|
|
|
|
; X64: vmovups {{%ymm([8-9]|1[0-5])}}, {{.*}}(%rsp) ## 32-byte Spill
|
|
|
|
; X64: vmovups {{%ymm([8-9]|1[0-5])}}, {{.*}}(%rsp) ## 32-byte Spill
|
|
|
|
; X64: vmovups {{%ymm([8-9]|1[0-5])}}, {{.*}}(%rsp) ## 32-byte Spill
|
|
|
|
; X64: vmovups {{%ymm([8-9]|1[0-5])}}, {{.*}}(%rsp) ## 32-byte Spill
|
2012-11-20 17:37:57 +08:00
|
|
|
; X64: call
|
2014-11-19 07:38:19 +08:00
|
|
|
; X64: vmovups {{.*}}(%rsp), {{%ymm([8-9]|1[0-5])}} ## 32-byte Reload
|
|
|
|
; X64: vmovups {{.*}}(%rsp), {{%ymm([8-9]|1[0-5])}} ## 32-byte Reload
|
|
|
|
; X64: vmovups {{.*}}(%rsp), {{%ymm([8-9]|1[0-5])}} ## 32-byte Reload
|
|
|
|
; X64: vmovups {{.*}}(%rsp), {{%ymm([8-9]|1[0-5])}} ## 32-byte Reload
|
|
|
|
; X64: vmovups {{.*}}(%rsp), {{%ymm([8-9]|1[0-5])}} ## 32-byte Reload
|
|
|
|
; X64: vmovups {{.*}}(%rsp), {{%ymm([8-9]|1[0-5])}} ## 32-byte Reload
|
|
|
|
; X64: vmovups {{.*}}(%rsp), {{%ymm([8-9]|1[0-5])}} ## 32-byte Reload
|
|
|
|
; X64: vmovups {{.*}}(%rsp), {{%ymm([8-9]|1[0-5])}} ## 32-byte Reload
|
2012-10-24 22:46:16 +08:00
|
|
|
define intel_ocl_bicc <16 x float> @test_prolog_epilog(<16 x float> %a, <16 x float> %b) nounwind {
|
|
|
|
%c = call <16 x float> @func_float16(<16 x float> %a, <16 x float> %b)
|
|
|
|
ret <16 x float> %c
|
2012-10-25 16:38:42 +08:00
|
|
|
}
|
2012-11-20 17:37:57 +08:00
|
|
|
|
|
|
|
; test functions with integer parameters
|
|
|
|
; pass parameters on stack for 32-bit platform
|
2014-06-25 20:41:52 +08:00
|
|
|
; X32-LABEL: test_int
|
2012-11-20 17:37:57 +08:00
|
|
|
; X32: movl {{.*}}, 4(%esp)
|
|
|
|
; X32: movl {{.*}}, (%esp)
|
|
|
|
; X32: call
|
|
|
|
; X32: addl {{.*}}, %eax
|
|
|
|
|
|
|
|
; pass parameters in registers for 64-bit platform
|
2014-06-25 20:41:52 +08:00
|
|
|
; X64-LABEL: test_int
|
2012-11-20 17:37:57 +08:00
|
|
|
; X64: leal {{.*}}, %edi
|
|
|
|
; X64: movl {{.*}}, %esi
|
|
|
|
; X64: call
|
|
|
|
; X64: addl {{.*}}, %eax
|
|
|
|
define i32 @test_int(i32 %a, i32 %b) nounwind {
|
|
|
|
%c1 = add i32 %a, %b
|
|
|
|
%c2 = call intel_ocl_bicc i32 @func_int(i32 %c1, i32 %a)
|
|
|
|
%c = add i32 %c2, %b
|
|
|
|
ret i32 %c
|
|
|
|
}
|
2013-02-13 16:02:04 +08:00
|
|
|
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64-LABEL: test_float4
|
2013-02-13 16:02:04 +08:00
|
|
|
; WIN64-NOT: vzeroupper
|
|
|
|
; WIN64: call
|
|
|
|
; WIN64-NOT: vzeroupper
|
|
|
|
; WIN64: call
|
|
|
|
; WIN64: ret
|
|
|
|
|
2014-06-25 20:41:52 +08:00
|
|
|
; X64-LABEL: test_float4
|
2013-02-13 16:02:04 +08:00
|
|
|
; X64-NOT: vzeroupper
|
|
|
|
; X64: call
|
|
|
|
; X64-NOT: vzeroupper
|
|
|
|
; X64: call
|
|
|
|
; X64: ret
|
|
|
|
|
2014-06-25 20:41:52 +08:00
|
|
|
; X32-LABEL: test_float4
|
2013-02-13 16:02:04 +08:00
|
|
|
; X32: vzeroupper
|
|
|
|
; X32: call
|
|
|
|
; X32: vzeroupper
|
|
|
|
; X32: call
|
|
|
|
; X32: ret
|
|
|
|
|
|
|
|
declare <4 x float> @func_float4(<4 x float>, <4 x float>, <4 x float>)
|
|
|
|
|
|
|
|
define <8 x float> @test_float4(<8 x float> %a, <8 x float> %b, <8 x float> %c) nounwind readnone {
|
|
|
|
entry:
|
|
|
|
%0 = shufflevector <8 x float> %a, <8 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
|
|
|
|
%1 = shufflevector <8 x float> %b, <8 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
|
|
|
|
%2 = shufflevector <8 x float> %c, <8 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
|
|
|
|
%call.i = tail call intel_ocl_bicc <4 x float> @func_float4(<4 x float> %0, <4 x float> %1, <4 x float> %2) nounwind
|
|
|
|
%3 = shufflevector <4 x float> %call.i, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
|
|
|
|
%4 = shufflevector <8 x float> %a, <8 x float> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
|
|
|
|
%5 = shufflevector <8 x float> %b, <8 x float> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
|
|
|
|
%6 = shufflevector <8 x float> %c, <8 x float> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
|
|
|
|
%call.i2 = tail call intel_ocl_bicc <4 x float> @func_float4(<4 x float> %4, <4 x float> %5, <4 x float> %6) nounwind
|
|
|
|
%7 = shufflevector <4 x float> %call.i2, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
|
|
|
|
%8 = shufflevector <8 x float> %3, <8 x float> %7, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
|
|
|
|
ret <8 x float> %8
|
|
|
|
}
|