From: Tom Stellard Date: Thu, 17 May 2012 22:21:24 +0000 (-0400) Subject: radeon/llvm: Add DAG nodes for MIN instructions X-Git-Tag: 062012170305~222 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e3cd8df183448e2cc01a8f2645a001b0972f4ab;p=profile%2Fivi%2Fmesa.git radeon/llvm: Add DAG nodes for MIN instructions Also, remove the AMDIL MIN* instruction defs. --- diff --git a/src/gallium/drivers/radeon/AMDGPUGenInstrEnums.pl b/src/gallium/drivers/radeon/AMDGPUGenInstrEnums.pl index 52b79bd..2b83273 100644 --- a/src/gallium/drivers/radeon/AMDGPUGenInstrEnums.pl +++ b/src/gallium/drivers/radeon/AMDGPUGenInstrEnums.pl @@ -55,7 +55,7 @@ my $FILE_TYPE = $ARGV[0]; open AMDIL, '<', 'AMDILInstructions.td'; -my @INST_ENUMS = ('NONE', 'FEQ', 'FGE', 'FLT', 'FNE', 'MOVE_f32', 'MOVE_i32', 'FTOI', 'ITOF', 'UGT', 'IGE', 'INE', 'UGE', 'IEQ', 'BINARY_OR_i32', 'BINARY_NOT_i32', 'MIN_f32'); +my @INST_ENUMS = ('NONE', 'FEQ', 'FGE', 'FLT', 'FNE', 'MOVE_f32', 'MOVE_i32', 'FTOI', 'ITOF', 'UGT', 'IGE', 'INE', 'UGE', 'IEQ', 'BINARY_OR_i32', 'BINARY_NOT_i32'); while () { if ($_ =~ /defm\s+([A-Z_]+)\s+:\s+([A-Za-z0-9]+); + +// out = min(a, b) a and b are floats +def AMDGPUfmin : SDNode<"AMDGPUISD::FMIN", SDTFPBinOp, + [SDNPCommutative, SDNPAssociative] +>; + +// out = min(a, b) a snd b are signed ints +def AMDGPUsmin : SDNode<"AMDGPUISD::SMIN", SDTIntBinOp, + [SDNPCommutative, SDNPAssociative] +>; + +// out = min(a, b) a and b are unsigned ints +def AMDGPUumin : SDNode<"AMDGPUISD::UMIN", SDTIntBinOp, + [SDNPCommutative, SDNPAssociative] +>; diff --git a/src/gallium/drivers/radeon/AMDILInstructions.td b/src/gallium/drivers/radeon/AMDILInstructions.td index 629a2c0..8f22d66 100644 --- a/src/gallium/drivers/radeon/AMDILInstructions.td +++ b/src/gallium/drivers/radeon/AMDILInstructions.td @@ -102,7 +102,6 @@ defm IMAD24 : TernaryIntrinsicInt; } defm CARRY : BinaryIntrinsicInt; defm BORROW : BinaryIntrinsicInt; -defm IMIN : BinaryIntrinsicInt; defm IMAX : BinaryIntrinsicInt; defm IBIT_EXTRACT : TernaryIntrinsicInt; @@ -137,7 +136,6 @@ defm UBIT_REVERSE : UnaryIntrinsicInt; defm UMULHI24 : BinaryIntrinsicInt; defm UMUL24 : BinaryIntrinsicInt; -defm UMIN : BinaryIntrinsicInt; defm UMAX : BinaryIntrinsicInt; defm UBIT_EXTRACT : TernaryIntrinsicInt; @@ -169,8 +167,6 @@ def LADD : TwoInOneOut; -defm IMIN64 : BinaryIntrinsicLong; -defm UMIN64 : BinaryIntrinsicLong; defm IMAX64 : BinaryIntrinsicLong; defm UMAX64 : BinaryIntrinsicLong; } @@ -250,7 +246,6 @@ defm POW : BinaryIntrinsicFloat; let hasIEEEFlag = 1 in { let mayLoad = 0, mayStore=0 in { -defm MIN : BinaryIntrinsicFloat; } defm MOD : BinaryOpMCf32; } @@ -367,7 +362,6 @@ def NEG_v2f64 : OneInOneOut; let mayLoad = 0, mayStore=0 in { -defm MIN : BinaryIntrinsicDouble; defm MAX : BinaryIntrinsicDouble; defm DIV : BinaryIntrinsicDouble; defm MAD : TernaryIntrinsicDouble; diff --git a/src/gallium/drivers/radeon/R600Instructions.td b/src/gallium/drivers/radeon/R600Instructions.td index 459010c..a42d917 100644 --- a/src/gallium/drivers/radeon/R600Instructions.td +++ b/src/gallium/drivers/radeon/R600Instructions.td @@ -265,9 +265,8 @@ def MAX : R600_2OP < def MIN : R600_2OP < 0x4, "MIN", - [(set R600_Reg32:$dst, (int_AMDIL_min R600_Reg32:$src0, R600_Reg32:$src1))]> { - let AMDILOp = AMDILInst.MIN_f32; -} + [(set R600_Reg32:$dst, (AMDGPUfmin R600_Reg32:$src0, R600_Reg32:$src1))] +>; /* For the SET* instructions there is a naming conflict in TargetSelectionDAG.td, * so some of the instruction names don't match the asm string. @@ -372,16 +371,17 @@ def MAX_INT : R600_2OP < def MIN_INT : R600_2OP < 0x37, "MIN_INT", - [(set R600_Reg32:$dst, (int_AMDGPU_imin R600_Reg32:$src0, R600_Reg32:$src1))]>; + [(set R600_Reg32:$dst, (AMDGPUsmin R600_Reg32:$src0, R600_Reg32:$src1))]>; def MAX_UINT : R600_2OP < 0x38, "MAX_UINT", - [(set R600_Reg32:$dst, (AMDGPUsmax R600_Reg32:$src0, R600_Reg32:$src1))]>; + [(set R600_Reg32:$dst, (AMDGPUsmax R600_Reg32:$src0, R600_Reg32:$src1))] +>; def MIN_UINT : R600_2OP < 0x39, "MIN_UINT", - [(set R600_Reg32:$dst, (int_AMDGPU_umin R600_Reg32:$src0, R600_Reg32:$src1))]>; - + [(set R600_Reg32:$dst, (AMDGPUumin R600_Reg32:$src0, R600_Reg32:$src1))] +>; def SETE_INT : R600_2OP < 0x3A, "SETE_INT",