2015-04-24 05:17:39 +08:00
|
|
|
; RUN: llc %s -mattr=+avx -o - | FileCheck %s
|
2017-02-04 10:27:13 +08:00
|
|
|
; Originally from http://llvm.org/PR21743.
|
2015-04-24 05:17:39 +08:00
|
|
|
|
|
|
|
target triple = "x86_64-pc-win32-elf"
|
|
|
|
|
2017-02-04 10:27:13 +08:00
|
|
|
; Copy propagation may remove COPYs if the result is only used by undef
|
|
|
|
; operands.
|
2015-04-24 05:17:39 +08:00
|
|
|
;
|
|
|
|
; CHECK-LABEL: foo:
|
|
|
|
; CHECK: movl $339752784, %e[[INDIRECT_CALL1:[a-z]+]]
|
|
|
|
; CHECK: callq *%r[[INDIRECT_CALL1]]
|
|
|
|
; Copy the result in a temporary.
|
2017-02-04 10:27:13 +08:00
|
|
|
; Note: Technically the regalloc could have been smarter and this move not
|
|
|
|
; required, which would have hidden the bug.
|
2016-08-11 15:32:08 +08:00
|
|
|
; CHECK: vmovapd %xmm0, [[TMP:%xmm[0-9]+]]
|
2017-02-04 10:27:13 +08:00
|
|
|
; CHECK-NOT: vxorps %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vcvtsi2sdq %rsi, %xmm0, %xmm6
|
2015-04-24 05:17:39 +08:00
|
|
|
; CHECK: movl $339772768, %e[[INDIRECT_CALL2:[a-z]+]]
|
2017-02-04 10:27:13 +08:00
|
|
|
; CHECK-NOT: vmovapd %xmm7, %xmm0
|
|
|
|
; CHECK-NEXT: vmovapd %xmm6, %xmm1
|
2015-04-24 05:17:39 +08:00
|
|
|
; Set TMP in the first argument of the second call.
|
2017-02-04 10:27:13 +08:00
|
|
|
; CHECK_NEXT: callq *%r[[INDIRECT_CALL2]]
|
2015-04-24 05:17:39 +08:00
|
|
|
; CHECK: retq
|
|
|
|
define double @foo(i64 %arg) {
|
|
|
|
top:
|
|
|
|
%tmp = call double inttoptr (i64 339752784 to double (double, double)*)(double 1.000000e+00, double 0.000000e+00)
|
2016-08-11 15:32:08 +08:00
|
|
|
tail call void asm sideeffect "", "x,~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15},~{dirflag},~{fpsr},~{flags}"(double %tmp)
|
2015-04-24 05:17:39 +08:00
|
|
|
%tmp1 = sitofp i64 %arg to double
|
|
|
|
call void inttoptr (i64 339772768 to void (double, double)*)(double %tmp, double %tmp1)
|
|
|
|
%tmp3 = fadd double %tmp1, %tmp
|
|
|
|
ret double %tmp3
|
|
|
|
}
|