2013-07-23 23:55:03 +00:00
|
|
|
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s --check-prefix=R600-CHECK
|
|
|
|
; RUN: llc < %s -march=r600 -mcpu=SI | 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-07-23 23:55:03 +00:00
|
|
|
; R600-CHECK: @fabs_free
|
|
|
|
; R600-CHECK-NOT: AND
|
|
|
|
; R600-CHECK: |PV.{{[XYZW]}}|
|
|
|
|
; SI-CHECK: @fabs_free
|
|
|
|
; SI-CHECK: V_ADD_F32_e64 VGPR{{[0-9]}}, SGPR{{[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
|
|
|
|
|
|
|
declare float @fabs(float ) readnone
|