[PATCH] R600/SI: implement range reduction for sin/cos
Grigori Goronzy
greg at chown.ath.cx
Fri Jun 20 10:27:11 PDT 2014
These instructions can only take a limited input range, and return
the constant value 1 out of range. We should do range reduction to
be able to process arbitrary values. Use a FRACT instruction after
normalization to achieve this.
---
lib/Target/R600/SIInstructions.td | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/Target/R600/SIInstructions.td b/lib/Target/R600/SIInstructions.td
index f888b8e..2bdcfd2 100644
--- a/lib/Target/R600/SIInstructions.td
+++ b/lib/Target/R600/SIInstructions.td
@@ -2253,12 +2253,12 @@ def : Pat<
def : Pat <
(fcos f32:$src0),
- (V_COS_F32_e32 (V_MUL_F32_e32 $src0, (V_MOV_B32_e32 CONST.TWO_PI_INV)))
+ (V_COS_F32_e32 (V_FRACT_F32_e32(V_MUL_F32_e32 $src0, (V_MOV_B32_e32 CONST.TWO_PI_INV))))
>;
def : Pat <
(fsin f32:$src0),
- (V_SIN_F32_e32 (V_MUL_F32_e32 $src0, (V_MOV_B32_e32 CONST.TWO_PI_INV)))
+ (V_SIN_F32_e32 (V_FRACT_F32_e32(V_MUL_F32_e32 $src0, (V_MOV_B32_e32 CONST.TWO_PI_INV))))
>;
def : Pat <
--
1.8.3.2
More information about the llvm-commits
mailing list