[llvm-commits] [llvm] r72558 - in /llvm/trunk: lib/Target/X86/X86Instr64bit.td lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/h-registers-3.ll test/CodeGen/X86/remat-mov0.ll
Evan Cheng
evan.cheng at apple.com
Thu May 28 18:44:44 PDT 2009
Author: evancheng
Date: Thu May 28 20:44:43 2009
New Revision: 72558
URL: http://llvm.org/viewvc/llvm-project?rev=72558&view=rev
Log:
More h-registers tricks: folding zext nodes.
Added:
llvm/trunk/test/CodeGen/X86/h-registers-3.ll
llvm/trunk/test/CodeGen/X86/remat-mov0.ll
- copied unchanged from r71476, llvm/trunk/test/CodeGen/X86/remat-mov0.ll
Modified:
llvm/trunk/lib/Target/X86/X86Instr64bit.td
llvm/trunk/lib/Target/X86/X86InstrInfo.td
Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=72558&r1=72557&r2=72558&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original)
+++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Thu May 28 20:44:43 2009
@@ -1607,6 +1607,13 @@
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
x86_subreg_8bit_hi))>,
Requires<[In64BitMode]>;
+def : Pat<(i64 (zext (srl_su GR32:$src, (i8 8)))),
+ (SUBREG_TO_REG
+ (i64 0),
+ (MOVZX32_NOREXrr8
+ (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
+ x86_subreg_8bit_hi)),
+ x86_subreg_32bit)>;
def : Pat<(srl_su GR16:$src, (i8 8)),
(EXTRACT_SUBREG
(MOVZX32_NOREXrr8
@@ -1614,6 +1621,18 @@
x86_subreg_8bit_hi)),
x86_subreg_16bit)>,
Requires<[In64BitMode]>;
+def : Pat<(i32 (zext (srl_su GR16:$src, (i8 8)))),
+ (MOVZX32_NOREXrr8
+ (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
+ x86_subreg_8bit_hi))>,
+ Requires<[In64BitMode]>;
+def : Pat<(i64 (zext (srl_su GR16:$src, (i8 8)))),
+ (SUBREG_TO_REG
+ (i64 0),
+ (MOVZX32_NOREXrr8
+ (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
+ x86_subreg_8bit_hi)),
+ x86_subreg_32bit)>;
// h-register extract and store.
def : Pat<(store (i8 (trunc_su (srl_su GR64:$src, (i8 8)))), addr:$dst),
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=72558&r1=72557&r2=72558&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Thu May 28 20:44:43 2009
@@ -3538,6 +3538,10 @@
x86_subreg_8bit_hi)),
x86_subreg_16bit)>,
Requires<[In32BitMode]>;
+def : Pat<(i32 (zext (srl_su GR16:$src, (i8 8)))),
+ (MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
+ x86_subreg_8bit_hi))>,
+ Requires<[In32BitMode]>;
def : Pat<(and (srl_su GR32:$src, (i8 8)), (i32 255)),
(MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
x86_subreg_8bit_hi))>,
Added: llvm/trunk/test/CodeGen/X86/h-registers-3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/h-registers-3.ll?rev=72558&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/h-registers-3.ll (added)
+++ llvm/trunk/test/CodeGen/X86/h-registers-3.ll Thu May 28 20:44:43 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=x86 | grep mov | count 1
+; RUN: llvm-as < %s | llc -march=x86-64 | grep mov | count 1
+
+define zeroext i8 @foo() nounwind ssp {
+entry:
+ %0 = tail call zeroext i16 (...)* @bar() nounwind
+ %1 = lshr i16 %0, 8
+ %2 = trunc i16 %1 to i8
+ ret i8 %2
+}
+
+declare zeroext i16 @bar(...)
More information about the llvm-commits
mailing list