1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=R600 -check-prefix=FUNC %s
5 ; DAGCombiner will transform:
6 ; (fabs (f32 bitcast (i32 a))) => (f32 bitcast (and (i32 a), 0x7FFFFFFF))
7 ; unless isFabsFree returns true
9 ; FUNC-LABEL: @fneg_fabs_free_f32
11 ; R600: |PV.{{[XYZW]}}|
15 define void @fneg_fabs_free_f32(float addrspace(1)* %out, i32 %in) {
16 %bc = bitcast i32 %in to float
17 %fabs = call float @llvm.fabs.f32(float %bc)
18 %fsub = fsub float -0.000000e+00, %fabs
19 store float %fsub, float addrspace(1)* %out
23 ; FUNC-LABEL: @fneg_fabs_fn_free_f32
25 ; R600: |PV.{{[XYZW]}}|
29 define void @fneg_fabs_fn_free_f32(float addrspace(1)* %out, i32 %in) {
30 %bc = bitcast i32 %in to float
31 %fabs = call float @fabs(float %bc)
32 %fsub = fsub float -0.000000e+00, %fabs
33 store float %fsub, float addrspace(1)* %out
37 ; FUNC-LABEL: @fneg_fabs_v2f32
38 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
40 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
45 define void @fneg_fabs_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %in) {
46 %fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %in)
47 %fsub = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, %fabs
48 store <2 x float> %fsub, <2 x float> addrspace(1)* %out
52 ; FUNC-LABEL: @fneg_fabs_v4f32
57 define void @fneg_fabs_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) {
58 %fabs = call <4 x float> @llvm.fabs.v4f32(<4 x float> %in)
59 %fsub = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %fabs
60 store <4 x float> %fsub, <4 x float> addrspace(1)* %out
64 declare float @fabs(float) readnone
65 declare float @llvm.fabs.f32(float) readnone
66 declare <2 x float> @llvm.fabs.v2f32(<2 x float>) readnone
67 declare <4 x float> @llvm.fabs.v4f32(<4 x float>) readnone