Two peepholes:
authorEvan Cheng <evan.cheng@apple.com>
Thu, 19 Jan 2006 01:56:29 +0000 (01:56 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 19 Jan 2006 01:56:29 +0000 (01:56 +0000)
(or (x >> c) | (y << (32 - c))) ==> (shrd x, y, c)
(or (x << c) | (y >> (32 - c))) ==> (shld x, y, c)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25438 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.td

index 958aa098c1073d49eda46c33ceb82984e1b20641..741e7d17812ecf46423290ed9912ee7692f184ff 100644 (file)
@@ -3066,3 +3066,13 @@ def : Pat<(f64 (undef)), (FpLD0)>,  Requires<[FPStack]>;
 def : Pat<(shl R8 :$src1, (i8 1)), (ADD8rr  R8 :$src1, R8 :$src1)>;
 def : Pat<(shl R16:$src1, (i8 1)), (ADD16rr R16:$src1, R16:$src1)>;
 def : Pat<(shl R32:$src1, (i8 1)), (ADD32rr R32:$src1, R32:$src1)>;
+
+// (or (x >> c) | (y << (32 - c))) ==> (shrd x, y, c)
+def : Pat<(or (srl R32:$src1, CL:$amt),
+              (shl R32:$src2, (sub 32, CL:$amt))),
+          (SHRD32rrCL R32:$src1, R32:$src2)>;
+
+// (or (x << c) | (y >> (32 - c))) ==> (shld x, y, c)
+def : Pat<(or (shl R32:$src1, CL:$amt),
+              (srl R32:$src2, (sub 32, CL:$amt))),
+          (SHLD32rrCL R32:$src1, R32:$src2)>;