1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=sse | FileCheck %s
3 ; FNEG is defined as subtraction from -0.0.
5 ; This test verifies that we use an xor with a constant to flip the sign bits; no subtraction needed.
6 define <4 x float> @t1(<4 x float> %Q) {
8 ; CHECK: xorps {{.*}}LCPI0_0{{.*}}, %xmm0
10 %tmp = fsub <4 x float> < float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00 >, %Q
14 ; This test verifies that we generate an FP subtraction because "0.0 - x" is not an fneg.
15 define <4 x float> @t2(<4 x float> %Q) {
17 ; CHECK: xorps %[[X:xmm[0-9]+]], %[[X]]
18 ; CHECK-NEXT: subps %xmm0, %[[X]]
19 ; CHECK-NEXT: movaps %[[X]], %xmm0
21 %tmp = fsub <4 x float> zeroinitializer, %Q
25 ; If we're bitcasting an integer to an FP vector, we should avoid the FPU/vector unit entirely.
26 ; Make sure that we're flipping the sign bit and only the sign bit of each float.
27 ; So instead of something like this:
29 ; xorps .LCPI2_0(%rip), %xmm0
32 ; movabsq (put sign bit mask in integer register))
33 ; xorq (flip sign bits)
34 ; movd (move to xmm return register)
36 define <2 x float> @fneg_bitcast(i64 %i) {
37 ; CHECK-LABEL: fneg_bitcast:
38 ; CHECK: movabsq $-9223372034707292160, %rax # imm = 0x8000000080000000
39 ; CHECK-NEXT: xorq %rdi, %rax
40 ; CHECK-NEXT: movd %rax, %xmm0
42 %bitcast = bitcast i64 %i to <2 x float>
43 %fneg = fsub <2 x float> <float -0.0, float -0.0>, %bitcast