AMDGPU/SI: select S_ABS_I32 when possible (v2)
[oota-llvm.git] / lib / Target / AMDGPU / SIInstructions.td
index 98d74a217ac008635ca23c8604c9aa71f4447d5d..bc2b0c6c07fb15e24df75782ea46e2b13c1ba3d5 100644 (file)
@@ -2174,6 +2174,11 @@ def : Pat <
      (S_MOV_B32 0), sub1))
 >;
 
+def : Pat <
+  (i32 (smax i32:$x, (i32 (ineg i32:$x)))),
+  (S_ABS_I32 $x)
+>;
+
 //===----------------------------------------------------------------------===//
 // SOP2 Patterns
 //===----------------------------------------------------------------------===//