================
@@ -2381,25 +2387,38 @@ def INT_PTX_LDG_G_v4i32_ELE : VLDG_G_ELE_V4<"u32", 
Int32Regs>;
 def INT_PTX_LDG_G_v4f32_ELE : VLDG_G_ELE_V4<"f32", Float32Regs>;
 
 
-multiclass NG_TO_G<string Str> {
-   def "" : NVPTXInst<(outs Int32Regs:$result), (ins Int32Regs:$src),
-          "cvta." # Str # ".u32 \t$result, $src;", []>;
-   def _64 : NVPTXInst<(outs Int64Regs:$result), (ins Int64Regs:$src),
-          "cvta." # Str # ".u64 \t$result, $src;", []>;
+multiclass NG_TO_G<string Str, bit Supports32 = 1, list<Predicate> Preds = []> 
{
+  foreach bitwidth = !if(Supports32, ["32", "64"], ["64"]) in {
+    if !eq(bitwidth, "32") then {
+      def "" : NVPTXInst<(outs Int32Regs:$result), (ins Int32Regs:$src),
+               "cvta." # Str # ".u32 \t$result, $src;", []>, Requires<Preds>;
+    } else if !eq(bitwidth, "64") then {
+      def _64 : NVPTXInst<(outs Int64Regs:$result), (ins Int64Regs:$src),
+                "cvta." # Str # ".u64 \t$result, $src;", []>, Requires<Preds>;
+    }
+  }
 }
 
-multiclass G_TO_NG<string Str> {
-   def "" : NVPTXInst<(outs Int32Regs:$result), (ins Int32Regs:$src),
-          "cvta.to." # Str # ".u32 \t$result, $src;", []>;
-   def _64 : NVPTXInst<(outs Int64Regs:$result), (ins Int64Regs:$src),
-          "cvta.to." # Str # ".u64 \t$result, $src;", []>;
+multiclass G_TO_NG<string Str, bit Supports32 = 1, list<Predicate> Preds = []> 
{
+  foreach bitwidth = !if(Supports32, ["32", "64"], ["64"]) in {
----------------
AlexMaclean wrote:

I don't think this foreach loop is really accomplishing much. Can it just be 
removed?

https://github.com/llvm/llvm-project/pull/135444
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to