forked from OSchip/llvm-project
R600: Fix FROUND
round halfway cases away from zero Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewed-by: Tom Stellard <tom@stellard.net> llvm-svn: 217250
This commit is contained in:
parent
0c93c9ecee
commit
d1d1334064
|
@ -537,7 +537,7 @@ def : Pat<(fp_to_uint f32:$src0), (FLT_TO_UINT_eg (TRUNC $src0))>;
|
|||
// SHA-256 Patterns
|
||||
def : SHA256MaPattern <BFI_INT_eg, XOR_INT>;
|
||||
|
||||
def : FROUNDPat <CNDGE_eg>;
|
||||
def : FROUNDPat <CNDGE_eg, CNDGT_eg>;
|
||||
|
||||
def EG_ExportSwz : ExportSwzInst {
|
||||
let Word1{19-16} = 0; // BURST_COUNT
|
||||
|
|
|
@ -1141,9 +1141,12 @@ class TGSI_LIT_Z_Common <InstR600 mul_lit, InstR600 log_clamped, InstR600 exp_ie
|
|||
>;
|
||||
|
||||
// FROUND pattern
|
||||
class FROUNDPat<Instruction CNDGE> : Pat <
|
||||
class FROUNDPat<Instruction CNDGE, Instruction CNDGT> : Pat <
|
||||
(AMDGPUround f32:$x),
|
||||
(CNDGE (ADD (FNEG_R600 (f32 HALF)), (FRACT $x)), (CEIL $x), (FLOOR $x))
|
||||
(CNDGE $x,
|
||||
(CNDGE (ADD (FNEG_R600 (f32 HALF)), (FRACT $x)), (CEIL $x), (FLOOR $x)),
|
||||
(CNDGT (ADD (FNEG_R600 (f32 HALF)), (FRACT $x)), (CEIL $x), (FLOOR $x))
|
||||
)
|
||||
>;
|
||||
|
||||
|
||||
|
@ -1190,7 +1193,7 @@ let Predicates = [isR600] in {
|
|||
def : Pat<(fsqrt f32:$src), (MUL $src, (RECIPSQRT_CLAMPED_r600 $src))>;
|
||||
defm : RsqPat<RECIPSQRT_IEEE_r600, f32>;
|
||||
|
||||
def : FROUNDPat <CNDGE_r600>;
|
||||
def : FROUNDPat <CNDGE_r600, CNDGT_r600>;
|
||||
|
||||
def R600_ExportSwz : ExportSwzInst {
|
||||
let Word1{20-17} = 0; // BURST_COUNT
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s --check-prefix=R600 --check-prefix=FUNC
|
||||
; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck %s --check-prefix=R600 --check-prefix=FUNC
|
||||
|
||||
; FUNC-LABEL: @f32
|
||||
; R600: FRACT
|
||||
; R600-DAG: ADD
|
||||
; R600-DAG: CEIL
|
||||
; R600-DAG: FLOOR
|
||||
; R600: CNDGE
|
||||
; R600: FRACT {{.*}}, [[ARG:KC[0-9]\[[0-9]+\]\.[XYZW]]]
|
||||
; R600-DAG: ADD {{.*}}, -0.5
|
||||
; R600-DAG: CEIL {{.*}} [[ARG]]
|
||||
; R600-DAG: FLOOR {{.*}} [[ARG]]
|
||||
; R600-DAG: CNDGE
|
||||
; R600-DAG: CNDGT
|
||||
; R600: CNDGE {{[^,]+}}, [[ARG]]
|
||||
define void @f32(float addrspace(1)* %out, float %in) {
|
||||
entry:
|
||||
%0 = call float @llvm.round.f32(float %in)
|
||||
|
|
Loading…
Reference in New Issue