@@ -1945,68 +1945,53 @@ def Wrapper : SDNode<"NVPTXISD::Wrapper", SDTWrapper>;
19451945
19461946// Load a memory address into a u32 or u64 register.
19471947def MOV_ADDR : NVPTXInst<(outs Int32Regs:$dst), (ins ADDR_base:$a),
1948- "mov.u32 \t$dst, $a;",
1948+ "mov.b32 \t$dst, $a;",
19491949 [(set i32:$dst, (Wrapper tglobaladdr:$a))]>;
19501950def MOV_ADDR64 : NVPTXInst<(outs Int64Regs:$dst), (ins ADDR_base:$a),
1951- "mov.u64 \t$dst, $a;",
1951+ "mov.b64 \t$dst, $a;",
19521952 [(set i64:$dst, (Wrapper tglobaladdr:$a))]>;
19531953
19541954// Get pointer to local stack.
19551955let hasSideEffects = false in {
19561956 def MOV_DEPOT_ADDR : NVPTXInst<(outs Int32Regs:$d), (ins i32imm:$num),
1957- "mov.u32 \t$d, __local_depot$num;", []>;
1957+ "mov.b32 \t$d, __local_depot$num;", []>;
19581958 def MOV_DEPOT_ADDR_64 : NVPTXInst<(outs Int64Regs:$d), (ins i32imm:$num),
1959- "mov.u64 \t$d, __local_depot$num;", []>;
1959+ "mov.b64 \t$d, __local_depot$num;", []>;
19601960}
19611961
19621962
19631963// copyPhysreg is hard-coded in NVPTXInstrInfo.cpp
1964- let hasSideEffects=0, isAsCheapAsAMove=1 in {
1965- def IMOV1rr : NVPTXInst<(outs Int1Regs:$dst), (ins Int1Regs:$sss),
1966- "mov.pred \t$dst, $sss;", []>;
1967- def IMOV16rr : NVPTXInst<(outs Int16Regs:$dst), (ins Int16Regs:$sss),
1968- "mov.u16 \t$dst, $sss;", []>;
1969- def IMOV32rr : NVPTXInst<(outs Int32Regs:$dst), (ins Int32Regs:$sss),
1970- "mov.u32 \t$dst, $sss;", []>;
1971- def IMOV64rr : NVPTXInst<(outs Int64Regs:$dst), (ins Int64Regs:$sss),
1972- "mov.u64 \t$dst, $sss;", []>;
1973- def IMOV128rr : NVPTXInst<(outs Int128Regs:$dst), (ins Int128Regs:$sss),
1974- "mov.b128 \t$dst, $sss;", []>;
1975-
1976- def FMOV32rr : NVPTXInst<(outs Float32Regs:$dst), (ins Float32Regs:$src),
1977- "mov.f32 \t$dst, $src;", []>;
1978- def FMOV64rr : NVPTXInst<(outs Float64Regs:$dst), (ins Float64Regs:$src),
1979- "mov.f64 \t$dst, $src;", []>;
1980-
1981- def IMOV1ri : NVPTXInst<(outs Int1Regs:$dst), (ins i1imm:$src),
1982- "mov.pred \t$dst, $src;",
1983- [(set i1:$dst, imm:$src)]>;
1984- def IMOV16ri : NVPTXInst<(outs Int16Regs:$dst), (ins i16imm:$src),
1985- "mov.b16 \t$dst, $src;",
1986- [(set i16:$dst, imm:$src)]>;
1987- def IMOV32ri : NVPTXInst<(outs Int32Regs:$dst), (ins i32imm:$src),
1988- "mov.b32 \t$dst, $src;",
1989- [(set i32:$dst, imm:$src)]>;
1990- def IMOV64ri : NVPTXInst<(outs Int64Regs:$dst), (ins i64imm:$src),
1991- "mov.b64 \t$dst, $src;",
1992- [(set i64:$dst, imm:$src)]>;
1993-
1994- def FMOV16ri : NVPTXInst<(outs Int16Regs:$dst), (ins f16imm:$src),
1995- "mov.b16 \t$dst, $src;",
1996- [(set f16:$dst, fpimm:$src)]>;
1997- def BFMOV16ri : NVPTXInst<(outs Int16Regs:$dst), (ins bf16imm:$src),
1998- "mov.b16 \t$dst, $src;",
1999- [(set bf16:$dst, fpimm:$src)]>;
2000- def FMOV32ri : NVPTXInst<(outs Float32Regs:$dst), (ins f32imm:$src),
2001- "mov.f32 \t$dst, $src;",
2002- [(set f32:$dst, fpimm:$src)]>;
2003- def FMOV64ri : NVPTXInst<(outs Float64Regs:$dst), (ins f64imm:$src),
2004- "mov.f64 \t$dst, $src;",
2005- [(set f64:$dst, fpimm:$src)]>;
2006- }
2007-
2008- def : Pat<(i32 (Wrapper texternalsym:$dst)), (IMOV32ri texternalsym:$dst)>;
2009- def : Pat<(i64 (Wrapper texternalsym:$dst)), (IMOV64ri texternalsym:$dst)>;
1964+ let hasSideEffects = false, isAsCheapAsAMove = true in {
1965+ // Class for register-to-register moves
1966+ class MOVr<RegisterClass RC, string OpStr> :
1967+ NVPTXInst<(outs RC:$dst), (ins RC:$src),
1968+ "mov." # OpStr # " \t$dst, $src;", []>;
1969+
1970+ // Class for immediate-to-register moves
1971+ class MOVi<RegisterClass RC, string OpStr, ValueType VT, Operand IMMType, SDNode ImmNode> :
1972+ NVPTXInst<(outs RC:$dst), (ins IMMType:$src),
1973+ "mov." # OpStr # " \t$dst, $src;",
1974+ [(set VT:$dst, ImmNode:$src)]>;
1975+ }
1976+
1977+ def IMOV1r : MOVr<Int1Regs, "pred">;
1978+ def IMOV1i : MOVi<Int1Regs, "pred", i1, i1imm, imm>;
1979+ def MOV16r : MOVr<Int16Regs, "b16">;
1980+ def IMOV16i : MOVi<Int16Regs, "b16", i16, i16imm, imm>;
1981+ def IMOV32r : MOVr<Int32Regs, "b32">;
1982+ def IMOV32i : MOVi<Int32Regs, "b32", i32, i32imm, imm>;
1983+ def IMOV64r : MOVr<Int64Regs, "b64">;
1984+ def IMOV64i : MOVi<Int64Regs, "b64", i64, i64imm, imm>;
1985+ def IMOV128r : MOVr<Int128Regs, "b128">;
1986+ def FMOV16i : MOVi<Int16Regs, "b16", f16, f16imm, fpimm>;
1987+ def BFMOV16i : MOVi<Int16Regs, "b16", bf16, bf16imm, fpimm>;
1988+ def FMOV32r : MOVr<Float32Regs, "b32">;
1989+ def FMOV32i : MOVi<Float32Regs, "b32", f32, f32imm, fpimm>;
1990+ def FMOV64r : MOVr<Float64Regs, "b64">;
1991+ def FMOV64i : MOVi<Float64Regs, "b64", f64, f64imm, fpimm>;
1992+
1993+ def : Pat<(i32 (Wrapper texternalsym:$dst)), (IMOV32i texternalsym:$dst)>;
1994+ def : Pat<(i64 (Wrapper texternalsym:$dst)), (IMOV64i texternalsym:$dst)>;
20101995
20111996//---- Copy Frame Index ----
20121997def LEA_ADDRi : NVPTXInst<(outs Int32Regs:$dst), (ins ADDR:$addr),
@@ -2717,8 +2702,8 @@ def ProxyRegI1 : ProxyRegInst<"pred", i1, Int1Regs>;
27172702def ProxyRegI16 : ProxyRegInst<"b16", i16, Int16Regs>;
27182703def ProxyRegI32 : ProxyRegInst<"b32", i32, Int32Regs>;
27192704def ProxyRegI64 : ProxyRegInst<"b64", i64, Int64Regs>;
2720- def ProxyRegF32 : ProxyRegInst<"f32 ", f32, Float32Regs>;
2721- def ProxyRegF64 : ProxyRegInst<"f64 ", f64, Float64Regs>;
2705+ def ProxyRegF32 : ProxyRegInst<"b32 ", f32, Float32Regs>;
2706+ def ProxyRegF64 : ProxyRegInst<"b64 ", f64, Float64Regs>;
27222707
27232708foreach vt = [f16, bf16] in {
27242709 def: Pat<(vt (ProxyReg vt:$src)), (ProxyRegI16 $src)>;
0 commit comments