aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-05-03 17:21:20 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-05-03 17:21:20 +0000
commit83f0a5a5e8e132b3ce39f15ed2583ad344b88ec4 (patch)
tree724d830066a560147a6f33911b837b5e16213171 /lib
parent218b20a81e28ab069dd69684f1a8208ec8e1704c (diff)
downloadexternal_llvm-83f0a5a5e8e132b3ce39f15ed2583ad344b88ec4.zip
external_llvm-83f0a5a5e8e132b3ce39f15ed2583ad344b88ec4.tar.gz
external_llvm-83f0a5a5e8e132b3ce39f15ed2583ad344b88ec4.tar.bz2
R600: Add pattern for SHA-256 Ma function
This can be optimized using the BFI_INT instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/R600/AMDGPUInstructions.td8
-rw-r--r--lib/Target/R600/R600Instructions.td3
-rw-r--r--lib/Target/R600/SIInstructions.td6
3 files changed, 17 insertions, 0 deletions
diff --git a/lib/Target/R600/AMDGPUInstructions.td b/lib/Target/R600/AMDGPUInstructions.td
index 83e1359..b44d248 100644
--- a/lib/Target/R600/AMDGPUInstructions.td
+++ b/lib/Target/R600/AMDGPUInstructions.td
@@ -276,6 +276,14 @@ multiclass BFIPatterns <Instruction BFI_INT> {
}
+// SHA-256 Ma patterns
+
+// ((x & z) | (y & (x | z))) -> BFI_INT (XOR x, y), z, y
+class SHA256MaPattern <Instruction BFI_INT, Instruction XOR> : Pat <
+ (or (and i32:$x, i32:$z), (and i32:$y, (or i32:$x, i32:$z))),
+ (BFI_INT (XOR i32:$x, i32:$y), i32:$z, i32:$y)
+>;
+
include "R600Instructions.td"
include "SIInstrInfo.td"
diff --git a/lib/Target/R600/R600Instructions.td b/lib/Target/R600/R600Instructions.td
index 6bae4b3..0466c18 100644
--- a/lib/Target/R600/R600Instructions.td
+++ b/lib/Target/R600/R600Instructions.td
@@ -1669,6 +1669,9 @@ let hasSideEffects = 1 in {
def : Pat<(fp_to_uint f32:$src0), (FLT_TO_UINT_eg (TRUNC $src0))>;
+ // SHA-256 Patterns
+ def : SHA256MaPattern <BFI_INT_eg, XOR_INT>;
+
def EG_ExportSwz : ExportSwzInst {
let Word1{19-16} = 0; // BURST_COUNT
let Word1{20} = 1; // VALID_PIXEL_MODE
diff --git a/lib/Target/R600/SIInstructions.td b/lib/Target/R600/SIInstructions.td
index 3ff4548..fcae109 100644
--- a/lib/Target/R600/SIInstructions.td
+++ b/lib/Target/R600/SIInstructions.td
@@ -1592,4 +1592,10 @@ def : Pat<
(V_CMP_U_F32_e64 $src0, $src1)
>;
+//============================================================================//
+// Miscellaneous Optimization Patterns
+//============================================================================//
+
+def : SHA256MaPattern <V_BFI_B32, V_XOR_B32_e32>;
+
} // End isSI predicate