Mercurial > hg > CbC > CbC_llvm
comparison test/CodeGen/X86/vec_fneg.ll @ 77:54457678186b LLVM3.6
LLVM 3.6
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Sep 2014 22:06:00 +0900 |
parents | 95c75e76d11b |
children | 60c9769439b8 |
comparison
equal
deleted
inserted
replaced
34:e874dbf0ad9d | 77:54457678186b |
---|---|
1 ; RUN: llc < %s -march=x86 -mattr=+sse2 | 1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7 | FileCheck %s |
2 | 2 |
3 ; FNEG is defined as subtraction from -0.0. | |
4 | |
5 ; This test verifies that we use an xor with a constant to flip the sign bits; no subtraction needed. | |
3 define <4 x float> @t1(<4 x float> %Q) { | 6 define <4 x float> @t1(<4 x float> %Q) { |
4 %tmp15 = fsub <4 x float> < float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00 >, %Q | 7 ; CHECK-LABEL: t1: |
5 ret <4 x float> %tmp15 | 8 ; CHECK: xorps {{.*}}LCPI0_0{{.*}}, %xmm0 |
9 ; CHECK-NEXT: retq | |
10 %tmp = fsub <4 x float> < float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00 >, %Q | |
11 ret <4 x float> %tmp | |
6 } | 12 } |
7 | 13 |
14 ; This test verifies that we generate an FP subtraction because "0.0 - x" is not an fneg. | |
8 define <4 x float> @t2(<4 x float> %Q) { | 15 define <4 x float> @t2(<4 x float> %Q) { |
9 %tmp15 = fsub <4 x float> zeroinitializer, %Q | 16 ; CHECK-LABEL: t2: |
10 ret <4 x float> %tmp15 | 17 ; CHECK: xorps %[[X:xmm[0-9]+]], %[[X]] |
18 ; CHECK-NEXT: subps %xmm0, %[[X]] | |
19 ; CHECK-NEXT: movaps %[[X]], %xmm0 | |
20 ; CHECK-NEXT: retq | |
21 %tmp = fsub <4 x float> zeroinitializer, %Q | |
22 ret <4 x float> %tmp | |
11 } | 23 } |
24 | |
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: | |
28 ; movd %rdi, %xmm0 | |
29 ; xorps .LCPI2_0(%rip), %xmm0 | |
30 ; | |
31 ; We should generate: | |
32 ; movabsq (put sign bit mask in integer register)) | |
33 ; xorq (flip sign bits) | |
34 ; movd (move to xmm return register) | |
35 | |
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 | |
41 ; CHECK-NEXT: retq | |
42 %bitcast = bitcast i64 %i to <2 x float> | |
43 %fneg = fsub <2 x float> <float -0.0, float -0.0>, %bitcast | |
44 ret <2 x float> %fneg | |
45 } |