From 175fdd7b86cce4e1fc945058fa2223b77edbf8a6 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Mon, 17 Sep 2012 22:20:18 +0200 Subject: [PATCH] radeon/llvm: Add a fdiv pattern. Reviewed-by: Tom Stellard --- src/gallium/drivers/radeon/R600Instructions.td | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeon/R600Instructions.td b/src/gallium/drivers/radeon/R600Instructions.td index 8d2f137434c..e2f8d338cc3 100644 --- a/src/gallium/drivers/radeon/R600Instructions.td +++ b/src/gallium/drivers/radeon/R600Instructions.td @@ -702,11 +702,18 @@ class COS_Common inst> : R600_1OP < // Helper patterns for complex intrinsics //===----------------------------------------------------------------------===// -class DIV_Common : Pat< +multiclass DIV_Common { +def : Pat< (int_AMDGPU_div R600_Reg32:$src0, R600_Reg32:$src1), (MUL R600_Reg32:$src0, (recip_ieee R600_Reg32:$src1)) >; +def : Pat< + (fdiv R600_Reg32:$src0, R600_Reg32:$src1), + (MUL R600_Reg32:$src0, (recip_ieee R600_Reg32:$src1)) +>; +} + class SSG_Common : Pat < (int_AMDGPU_ssg R600_Reg32:$src), (cndgt R600_Reg32:$src, (f32 ONE), (cndge R600_Reg32:$src, (f32 ZERO), (f32 NEG_ONE))) @@ -753,7 +760,7 @@ let Predicates = [isR600] in { def MULHI_UINT_r600 : MULHI_UINT_Common<0x76>; def RECIP_UINT_r600 : RECIP_UINT_Common <0x78>; - def DIV_r600 : DIV_Common; + defm DIV_r600 : DIV_Common; def POW_r600 : POW_Common; def SSG_r600 : SSG_Common; def TGSI_LIT_Z_r600 : TGSI_LIT_Z_Common; @@ -849,7 +856,7 @@ let Predicates = [isEGorCayman] in { def : DOT4_Pat ; defm CUBE_eg : CUBE_Common<0xC0>; - def DIV_eg : DIV_Common; + defm DIV_eg : DIV_Common; def POW_eg : POW_Common; def SSG_eg : SSG_Common; def TGSI_LIT_Z_eg : TGSI_LIT_Z_Common; -- 2.30.2