@@ -2543,59 +2543,45 @@ defm INT_PTX_LDG_G_v4f32_ELE
25432543 : VLDG_G_ELE_V4<"v4.f32 \t{{$dst1, $dst2, $dst3, $dst4}}, [$src];", Float32Regs>;
25442544
25452545
2546- multiclass NG_TO_G<string Str, Intrinsic Intrin, Predicate ShortPtr > {
2546+ multiclass NG_TO_G<string Str> {
25472547 def "" : NVPTXInst<(outs Int32Regs:$result), (ins Int32Regs:$src),
2548- !strconcat("cvta.", Str, ".u32 \t$result, $src;"),
2549- [(set Int32Regs:$result, (Intrin Int32Regs:$src))]>;
2548+ "cvta." # Str # ".u32 \t$result, $src;", []>;
25502549 def _64 : NVPTXInst<(outs Int64Regs:$result), (ins Int64Regs:$src),
2551- !strconcat("cvta.", Str, ".u64 \t$result, $src;"),
2552- [(set Int64Regs:$result, (Intrin Int64Regs:$src))]>;
2553- def _6432 : NVPTXInst<(outs Int64Regs:$result), (ins Int32Regs:$src),
2554- "{{ .reg .b64 %tmp;\n\t"
2555- #" cvt.u64.u32 \t%tmp, $src;\n\t"
2556- #" cvta." # Str # ".u64 \t$result, %tmp; }}",
2557- [(set Int64Regs:$result, (Intrin Int32Regs:$src))]>,
2558- Requires<[ShortPtr]>;
2550+ "cvta." # Str # ".u64 \t$result, $src;", []>;
25592551}
25602552
2561- multiclass G_TO_NG<string Str, Intrinsic Intrin, Predicate ShortPtr > {
2553+ multiclass G_TO_NG<string Str> {
25622554 def "" : NVPTXInst<(outs Int32Regs:$result), (ins Int32Regs:$src),
2563- !strconcat("cvta.to.", Str, ".u32 \t$result, $src;"),
2564- [(set Int32Regs:$result, (Intrin Int32Regs:$src))]>;
2555+ "cvta.to." # Str # ".u32 \t$result, $src;", []>;
25652556 def _64 : NVPTXInst<(outs Int64Regs:$result), (ins Int64Regs:$src),
2566- !strconcat("cvta.to.", Str, ".u64 \t$result, $src;"),
2567- [(set Int64Regs:$result, (Intrin Int64Regs:$src))]>;
2568- def _3264 : NVPTXInst<(outs Int32Regs:$result), (ins Int64Regs:$src),
2569- "{{ .reg .b64 %tmp;\n\t"
2570- #" cvta.to." # Str # ".u64 \t%tmp, $src;\n\t"
2571- #" cvt.u32.u64 \t$result, %tmp; }}",
2572- [(set Int32Regs:$result, (Intrin Int64Regs:$src))]>,
2573- Requires<[ShortPtr]>;
2574- }
2575-
2576- defm cvta_local : NG_TO_G<"local", int_nvvm_ptr_local_to_gen, useShortPtrLocal>;
2577- defm cvta_shared : NG_TO_G<"shared", int_nvvm_ptr_shared_to_gen, useShortPtrShared>;
2578- defm cvta_global : NG_TO_G<"global", int_nvvm_ptr_global_to_gen, False>;
2579- defm cvta_const : NG_TO_G<"const", int_nvvm_ptr_constant_to_gen, useShortPtrConst>;
2580- defm cvta_param : NG_TO_G<"param", int_nvvm_ptr_param_to_gen, False>;
2581-
2582- defm cvta_to_local : G_TO_NG<"local", int_nvvm_ptr_gen_to_local, useShortPtrLocal>;
2583- defm cvta_to_shared : G_TO_NG<"shared", int_nvvm_ptr_gen_to_shared, useShortPtrShared>;
2584- defm cvta_to_global : G_TO_NG<"global", int_nvvm_ptr_gen_to_global, False>;
2585- defm cvta_to_const : G_TO_NG<"const", int_nvvm_ptr_gen_to_constant, useShortPtrConst>;
2557+ "cvta.to." # Str # ".u64 \t$result, $src;", []>;
2558+ }
2559+
2560+ defm cvta_local : NG_TO_G<"local">;
2561+ defm cvta_shared : NG_TO_G<"shared">;
2562+ defm cvta_global : NG_TO_G<"global">;
2563+ defm cvta_const : NG_TO_G<"const">;
2564+
2565+ defm cvta_to_local : G_TO_NG<"local">;
2566+ defm cvta_to_shared : G_TO_NG<"shared">;
2567+ defm cvta_to_global : G_TO_NG<"global">;
2568+ defm cvta_to_const : G_TO_NG<"const">;
2569+
2570+ // nvvm.ptr.param.to.gen
2571+ defm cvta_param : NG_TO_G<"param">;
2572+
2573+ def : Pat<(int_nvvm_ptr_param_to_gen Int32Regs:$src),
2574+ (cvta_param Int32Regs:$src)>;
2575+
2576+ def : Pat<(int_nvvm_ptr_param_to_gen Int64Regs:$src),
2577+ (cvta_param_64 Int64Regs:$src)>;
25862578
25872579// nvvm.ptr.gen.to.param
2588- def nvvm_ptr_gen_to_param : NVPTXInst<(outs Int32Regs:$result),
2589- (ins Int32Regs:$src),
2590- "mov.u32 \t$result, $src;",
2591- [(set Int32Regs:$result,
2592- (int_nvvm_ptr_gen_to_param Int32Regs:$src))]>;
2593- def nvvm_ptr_gen_to_param_64 : NVPTXInst<(outs Int64Regs:$result),
2594- (ins Int64Regs:$src),
2595- "mov.u64 \t$result, $src;",
2596- [(set Int64Regs:$result,
2597- (int_nvvm_ptr_gen_to_param Int64Regs:$src))]>;
2580+ def : Pat<(int_nvvm_ptr_gen_to_param Int32Regs:$src),
2581+ (IMOV32rr Int32Regs:$src)>;
25982582
2583+ def : Pat<(int_nvvm_ptr_gen_to_param Int64Regs:$src),
2584+ (IMOV64rr Int64Regs:$src)>;
25992585
26002586// nvvm.move intrinsicc
26012587def nvvm_move_i16 : NVPTXInst<(outs Int16Regs:$r), (ins Int16Regs:$s),
@@ -2638,24 +2624,6 @@ def nvvm_move_sym64 : NVPTXInst<(outs Int64Regs:$r), (ins imem:$s),
26382624 [(set Int64Regs:$r,
26392625 (int_nvvm_move_ptr texternalsym:$s))]>;*/
26402626
2641-
2642- // MoveParam %r1, param
2643- // ptr_local_to_gen %r2, %r1
2644- // ptr_gen_to_local %r3, %r2
2645- // ->
2646- // mov %r1, param
2647-
2648- // @TODO: Revisit this. There is a type
2649- // contradiction between iPTRAny and iPTR for the addr defs, so the move_sym
2650- // instructions are not currently defined. However, we can use the ptr
2651- // variants and the asm printer will do the right thing.
2652- def : Pat<(i64 (int_nvvm_ptr_gen_to_local (int_nvvm_ptr_local_to_gen
2653- (MoveParam texternalsym:$src)))),
2654- (nvvm_move_ptr64 texternalsym:$src)>;
2655- def : Pat<(i32 (int_nvvm_ptr_gen_to_local (int_nvvm_ptr_local_to_gen
2656- (MoveParam texternalsym:$src)))),
2657- (nvvm_move_ptr32 texternalsym:$src)>;
2658-
26592627def texsurf_handles
26602628 : NVPTXInst<(outs Int64Regs:$result), (ins imem:$src),
26612629 "mov.u64 \t$result, $src;", []>;
0 commit comments