[llvm] r342788 - [X86] Teach fast isel to use MOV32ri64 for loading an unsigned 32 immediate into a 64-bit register.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 21 16:14:05 PDT 2018
Author: ctopper
Date: Fri Sep 21 16:14:05 2018
New Revision: 342788
URL: http://llvm.org/viewvc/llvm-project?rev=342788&view=rev
Log:
[X86] Teach fast isel to use MOV32ri64 for loading an unsigned 32 immediate into a 64-bit register.
Previously we used SUBREG_TO_REG+MOV32ri. But regular isel was changed recently to use the MOV32ri64 pseudo. Fast isel now does the same.
Modified:
llvm/trunk/lib/Target/X86/X86FastISel.cpp
llvm/trunk/test/CodeGen/X86/bmi-intrinsics-fast-isel-x86_64.ll
Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=342788&r1=342787&r2=342788&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Fri Sep 21 16:14:05 2018
@@ -3744,7 +3744,7 @@ unsigned X86FastISel::X86MaterializeInt(
case MVT::i32: Opc = X86::MOV32ri; break;
case MVT::i64: {
if (isUInt<32>(Imm))
- Opc = X86::MOV32ri;
+ Opc = X86::MOV32ri64;
else if (isInt<32>(Imm))
Opc = X86::MOV64ri32;
else
@@ -3752,14 +3752,6 @@ unsigned X86FastISel::X86MaterializeInt(
break;
}
}
- if (VT == MVT::i64 && Opc == X86::MOV32ri) {
- unsigned SrcReg = fastEmitInst_i(Opc, &X86::GR32RegClass, Imm);
- unsigned ResultReg = createResultReg(&X86::GR64RegClass);
- BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
- TII.get(TargetOpcode::SUBREG_TO_REG), ResultReg)
- .addImm(0).addReg(SrcReg).addImm(X86::sub_32bit);
- return ResultReg;
- }
return fastEmitInst_i(Opc, TLI.getRegClassFor(VT), Imm);
}
Modified: llvm/trunk/test/CodeGen/X86/bmi-intrinsics-fast-isel-x86_64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/bmi-intrinsics-fast-isel-x86_64.ll?rev=342788&r1=342787&r2=342788&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/bmi-intrinsics-fast-isel-x86_64.ll (original)
+++ llvm/trunk/test/CodeGen/X86/bmi-intrinsics-fast-isel-x86_64.ll Fri Sep 21 16:14:05 2018
@@ -67,9 +67,9 @@ define i64 @test__blsr_u64(i64 %a0) {
define i64 @test__tzcnt_u64(i64 %a0) {
; X64-LABEL: test__tzcnt_u64:
; X64: # %bb.0:
-; X64-NEXT: movl $64, %ecx
-; X64-NEXT: tzcntq %rdi, %rax
-; X64-NEXT: cmovbq %rcx, %rax
+; X64-NEXT: tzcntq %rdi, %rcx
+; X64-NEXT: movl $64, %eax
+; X64-NEXT: cmovaeq %rcx, %rax
; X64-NEXT: retq
%cmp = icmp ne i64 %a0, 0
%cttz = call i64 @llvm.cttz.i64(i64 %a0, i1 true)
@@ -151,9 +151,9 @@ define i64 @test_blsr_u64(i64 %a0) {
define i64 @test_tzcnt_u64(i64 %a0) {
; X64-LABEL: test_tzcnt_u64:
; X64: # %bb.0:
-; X64-NEXT: movl $64, %ecx
-; X64-NEXT: tzcntq %rdi, %rax
-; X64-NEXT: cmovbq %rcx, %rax
+; X64-NEXT: tzcntq %rdi, %rcx
+; X64-NEXT: movl $64, %eax
+; X64-NEXT: cmovaeq %rcx, %rax
; X64-NEXT: retq
%cmp = icmp ne i64 %a0, 0
%cttz = call i64 @llvm.cttz.i64(i64 %a0, i1 true)
More information about the llvm-commits
mailing list