1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7-avx | FileCheck %s
4 define <2 x double> @fabs_v2f64(<2 x double> %p)
6 ; CHECK-LABEL: fabs_v2f64
8 %t = call <2 x double> @llvm.fabs.v2f64(<2 x double> %p)
11 declare <2 x double> @llvm.fabs.v2f64(<2 x double> %p)
13 define <4 x float> @fabs_v4f32(<4 x float> %p)
15 ; CHECK-LABEL: fabs_v4f32
17 %t = call <4 x float> @llvm.fabs.v4f32(<4 x float> %p)
20 declare <4 x float> @llvm.fabs.v4f32(<4 x float> %p)
22 define <4 x double> @fabs_v4f64(<4 x double> %p)
24 ; CHECK-LABEL: fabs_v4f64
26 %t = call <4 x double> @llvm.fabs.v4f64(<4 x double> %p)
29 declare <4 x double> @llvm.fabs.v4f64(<4 x double> %p)
31 define <8 x float> @fabs_v8f32(<8 x float> %p)
33 ; CHECK-LABEL: fabs_v8f32
35 %t = call <8 x float> @llvm.fabs.v8f32(<8 x float> %p)
38 declare <8 x float> @llvm.fabs.v8f32(<8 x float> %p)
40 ; PR20354: when generating code for a vector fabs op,
41 ; make sure that we're only turning off the sign bit of each float value.
42 ; No constant pool loads or vector ops are needed for the fabs of a
43 ; bitcasted integer constant; we should just return an integer constant
44 ; that has the sign bits turned off.
46 ; So instead of something like this:
47 ; movabsq (constant pool load of mask for sign bits)
48 ; vmovq (move from integer register to vector/fp register)
49 ; vandps (mask off sign bits)
50 ; vmovq (move vector/fp register back to integer return register)
53 ; mov (put constant value in return register)
55 define i64 @fabs_v2f32_1() {
56 ; CHECK-LABEL: fabs_v2f32_1:
57 ; CHECK: movabsq $9223372032559808512, %rax # imm = 0x7FFFFFFF00000000
59 %bitcast = bitcast i64 18446744069414584320 to <2 x float> ; 0xFFFF_FFFF_0000_0000
60 %fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %bitcast)
61 %ret = bitcast <2 x float> %fabs to i64
65 define i64 @fabs_v2f32_2() {
66 ; CHECK-LABEL: fabs_v2f32_2:
67 ; CHECK: movl $2147483647, %eax # imm = 0x7FFFFFFF
69 %bitcast = bitcast i64 4294967295 to <2 x float> ; 0x0000_0000_FFFF_FFFF
70 %fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %bitcast)
71 %ret = bitcast <2 x float> %fabs to i64
75 declare <2 x float> @llvm.fabs.v2f32(<2 x float> %p)