summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/AMDGPUInstructions.td
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2012-05-25 10:50:35 -0400
committerTom Stellard <[email protected]>2012-05-25 15:40:58 -0400
commitd784bc77405012b442ae9d68f200e9d115030b3c (patch)
tree7d8b857f99d40f7e26e7f597385c53a6f7c227ee /src/gallium/drivers/radeon/AMDGPUInstructions.td
parent17f852892346fdf3b1e9eec56b7a55c470279bc8 (diff)
radeon/llvm: Use a custom inserter to lower CLAMP
Diffstat (limited to 'src/gallium/drivers/radeon/AMDGPUInstructions.td')
-rw-r--r--src/gallium/drivers/radeon/AMDGPUInstructions.td17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/AMDGPUInstructions.td b/src/gallium/drivers/radeon/AMDGPUInstructions.td
index e1ace508e88..1f0d582d82b 100644
--- a/src/gallium/drivers/radeon/AMDGPUInstructions.td
+++ b/src/gallium/drivers/radeon/AMDGPUInstructions.td
@@ -39,6 +39,16 @@ int TWO_PI_INV = 0x3e22f983;
}
def CONST : Constants;
+def FP_ZERO : PatLeaf <
+ (fpimm),
+ [{return N->getValueAPF().isZero();}]
+>;
+
+def FP_ONE : PatLeaf <
+ (fpimm),
+ [{return N->isExactlyValue(1.0);}]
+>;
+
let isCodeGenOnly = 1 in {
def MASK_WRITE : AMDGPUShaderInst <
@@ -50,6 +60,13 @@ let isCodeGenOnly = 1 in {
let isPseudo = 1, usesCustomInserter = 1 in {
+class CLAMP <RegisterClass rc> : AMDGPUShaderInst <
+ (outs rc:$dst),
+ (ins rc:$src0),
+ "CLAMP $dst, $src0",
+ [(set rc:$dst, (int_AMDIL_clamp rc:$src0, (f32 FP_ZERO), (f32 FP_ONE)))]
+>;
+
class FABS <RegisterClass rc> : AMDGPUShaderInst <
(outs rc:$dst),
(ins rc:$src0),