2013-07-23 23:55:03 +00:00
|
|
|
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s --check-prefix=R600-CHECK
|
2013-10-10 17:11:46 +00:00
|
|
|
; RUN: llc < %s -march=r600 -mcpu=SI -verify-machineinstrs | FileCheck %s --check-prefix=SI-CHECK
|
2012-12-11 21:25:42 +00:00
|
|
|
|
2013-07-23 23:55:03 +00:00
|
|
|
; DAGCombiner will transform:
|
|
|
|
; (fabs (f32 bitcast (i32 a))) => (f32 bitcast (and (i32 a), 0x7FFFFFFF))
|
|
|
|
; unless isFabsFree returns true
|
2012-12-11 21:25:42 +00:00
|
|
|
|
2013-11-27 21:23:39 +00:00
|
|
|
; R600-CHECK-LABEL: @fabs_free
|
2013-07-23 23:55:03 +00:00
|
|
|
; R600-CHECK-NOT: AND
|
|
|
|
; R600-CHECK: |PV.{{[XYZW]}}|
|
2013-11-27 21:23:39 +00:00
|
|
|
; SI-CHECK-LABEL: @fabs_free
|
2013-11-12 02:35:51 +00:00
|
|
|
; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0
|
2012-12-11 21:25:42 +00:00
|
|
|
|
2013-07-23 23:55:03 +00:00
|
|
|
define void @fabs_free(float addrspace(1)* %out, i32 %in) {
|
|
|
|
entry:
|
|
|
|
%0 = bitcast i32 %in to float
|
|
|
|
%1 = call float @fabs(float %0)
|
|
|
|
store float %1, float addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2012-12-11 21:25:42 +00:00
|
|
|
|
2013-11-27 21:23:39 +00:00
|
|
|
; R600-CHECK-LABEL: @fabs_v2
|
|
|
|
; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}|
|
|
|
|
; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}|
|
|
|
|
; SI-CHECK-LABEL: @fabs_v2
|
|
|
|
; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0
|
|
|
|
; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0
|
|
|
|
define void @fabs_v2(<2 x float> addrspace(1)* %out, <2 x float> %in) {
|
|
|
|
entry:
|
|
|
|
%0 = call <2 x float> @llvm.fabs.v2f32(<2 x float> %in)
|
|
|
|
store <2 x float> %0, <2 x float> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; R600-CHECK-LABEL: @fabs_v4
|
|
|
|
; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}|
|
|
|
|
; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}|
|
|
|
|
; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}|
|
|
|
|
; R600-CHECK: |{{(PV|T[0-9])\.[XYZW]}}|
|
|
|
|
; SI-CHECK-LABEL: @fabs_v4
|
|
|
|
; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0
|
|
|
|
; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0
|
|
|
|
; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0
|
|
|
|
; SI-CHECK: V_ADD_F32_e64 v{{[0-9]}}, s{{[0-9]}}, 0, 1, 0, 0, 0
|
|
|
|
define void @fabs_v4(<4 x float> addrspace(1)* %out, <4 x float> %in) {
|
|
|
|
entry:
|
|
|
|
%0 = call <4 x float> @llvm.fabs.v4f32(<4 x float> %in)
|
|
|
|
store <4 x float> %0, <4 x float> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2012-12-11 21:25:42 +00:00
|
|
|
declare float @fabs(float ) readnone
|
2013-11-27 21:23:39 +00:00
|
|
|
declare <2 x float> @llvm.fabs.v2f32(<2 x float> ) readnone
|
|
|
|
declare <4 x float> @llvm.fabs.v4f32(<4 x float> ) readnone
|