R600/SI: Add pattern for bswap
[oota-llvm.git] / lib / Target / R600 / SIInstructions.td
index 9d0cdf86f3cca71e1187b4e946fb29fdf99f9bd4..479eebefec0d41088781067bb09fce331aaacc09 100644 (file)
@@ -3056,6 +3056,13 @@ def : Pat <
   (V_CMP_EQ_I32_e64 (V_AND_B32_e64 (i32 1), $a), 1)
 >;
 
+def : Pat <
+  (i32 (bswap i32:$a)),
+  (V_BFI_B32 (S_MOV_B32 0x00ff00ff),
+             (V_ALIGNBIT_B32 $a, $a, 24),
+             (V_ALIGNBIT_B32 $a, $a, 8))
+>;
+
 //============================================================================//
 // Miscellaneous Optimization Patterns
 //============================================================================//