2016-04-02 04:55:19 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mattr=+sse2,-sse4.1 | FileCheck %s --check-prefix=X32
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+sse2,-sse4.1 | FileCheck %s --check-prefix=X64
|
2014-10-04 12:22:55 +08:00
|
|
|
|
2008-09-27 07:41:32 +08:00
|
|
|
define void @test1(<4 x float>* %F, float* %f) nounwind {
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-LABEL: test1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0: # %entry
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-NEXT: movaps (%ecx), %xmm0
|
|
|
|
; X32-NEXT: addps %xmm0, %xmm0
|
|
|
|
; X32-NEXT: movss %xmm0, (%eax)
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0: # %entry
|
2016-04-02 04:55:19 +08:00
|
|
|
; X64-NEXT: movaps (%rdi), %xmm0
|
|
|
|
; X64-NEXT: addps %xmm0, %xmm0
|
|
|
|
; X64-NEXT: movss %xmm0, (%rsi)
|
|
|
|
; X64-NEXT: retq
|
2014-09-11 08:13:35 +08:00
|
|
|
entry:
|
2016-04-02 04:55:19 +08:00
|
|
|
%tmp = load <4 x float>, <4 x float>* %F
|
|
|
|
%tmp7 = fadd <4 x float> %tmp, %tmp
|
|
|
|
%tmp2 = extractelement <4 x float> %tmp7, i32 0
|
|
|
|
store float %tmp2, float* %f
|
|
|
|
ret void
|
2006-04-21 01:59:30 +08:00
|
|
|
}
|
|
|
|
|
2008-09-27 07:41:32 +08:00
|
|
|
define float @test2(<4 x float>* %F, float* %f) nounwind {
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-LABEL: test2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0: # %entry
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-NEXT: pushl %eax
|
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: movaps (%eax), %xmm0
|
|
|
|
; X32-NEXT: addps %xmm0, %xmm0
|
2016-08-22 20:56:54 +08:00
|
|
|
; X32-NEXT: movhlps {{.*#+}} xmm0 = xmm0[1,1]
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-NEXT: movss %xmm0, (%esp)
|
|
|
|
; X32-NEXT: flds (%esp)
|
|
|
|
; X32-NEXT: popl %eax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0: # %entry
|
2016-04-02 04:55:19 +08:00
|
|
|
; X64-NEXT: movaps (%rdi), %xmm0
|
|
|
|
; X64-NEXT: addps %xmm0, %xmm0
|
2016-08-22 20:56:54 +08:00
|
|
|
; X64-NEXT: movhlps {{.*#+}} xmm0 = xmm0[1,1]
|
2016-04-02 04:55:19 +08:00
|
|
|
; X64-NEXT: retq
|
2014-09-11 08:13:35 +08:00
|
|
|
entry:
|
2016-04-02 04:55:19 +08:00
|
|
|
%tmp = load <4 x float>, <4 x float>* %F
|
|
|
|
%tmp7 = fadd <4 x float> %tmp, %tmp
|
|
|
|
%tmp2 = extractelement <4 x float> %tmp7, i32 2
|
|
|
|
ret float %tmp2
|
2006-04-21 01:59:30 +08:00
|
|
|
}
|
|
|
|
|
2008-09-27 07:41:32 +08:00
|
|
|
define void @test3(float* %R, <4 x float>* %P1) nounwind {
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-LABEL: test3:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0: # %entry
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
|
|
|
|
; X32-NEXT: movss %xmm0, (%eax)
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test3:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0: # %entry
|
2016-04-02 04:55:19 +08:00
|
|
|
; X64-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
|
|
|
|
; X64-NEXT: movss %xmm0, (%rdi)
|
|
|
|
; X64-NEXT: retq
|
2014-09-11 08:13:35 +08:00
|
|
|
entry:
|
2016-04-02 04:55:19 +08:00
|
|
|
%X = load <4 x float>, <4 x float>* %P1
|
|
|
|
%tmp = extractelement <4 x float> %X, i32 3
|
|
|
|
store float %tmp, float* %R
|
|
|
|
ret void
|
2006-04-21 01:59:30 +08:00
|
|
|
}
|
2006-10-28 05:05:18 +08:00
|
|
|
|
2008-09-27 07:41:32 +08:00
|
|
|
define double @test4(double %A) nounwind {
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-LABEL: test4:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0: # %entry
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-NEXT: subl $12, %esp
|
|
|
|
; X32-NEXT: calll foo
|
2018-08-03 00:48:01 +08:00
|
|
|
; X32-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1,1]
|
2016-04-02 04:55:19 +08:00
|
|
|
; X32-NEXT: addsd {{[0-9]+}}(%esp), %xmm0
|
|
|
|
; X32-NEXT: movsd %xmm0, (%esp)
|
|
|
|
; X32-NEXT: fldl (%esp)
|
|
|
|
; X32-NEXT: addl $12, %esp
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test4:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0: # %entry
|
2016-04-02 04:55:19 +08:00
|
|
|
; X64-NEXT: pushq %rax
|
|
|
|
; X64-NEXT: movsd %xmm0, (%rsp) # 8-byte Spill
|
|
|
|
; X64-NEXT: callq foo
|
2018-08-03 00:48:01 +08:00
|
|
|
; X64-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1,1]
|
2016-04-02 04:55:19 +08:00
|
|
|
; X64-NEXT: addsd (%rsp), %xmm0 # 8-byte Folded Reload
|
|
|
|
; X64-NEXT: popq %rax
|
|
|
|
; X64-NEXT: retq
|
2014-09-11 08:13:35 +08:00
|
|
|
entry:
|
2016-04-02 04:55:19 +08:00
|
|
|
%tmp1 = call <2 x double> @foo( )
|
|
|
|
%tmp2 = extractelement <2 x double> %tmp1, i32 1
|
|
|
|
%tmp3 = fadd double %tmp2, %A
|
|
|
|
ret double %tmp3
|
2006-10-28 05:05:18 +08:00
|
|
|
}
|
|
|
|
|
2008-02-21 15:42:26 +08:00
|
|
|
declare <2 x double> @foo()
|