================
@@ -0,0 +1,297 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 6
+; RUN: llc < %s -verify-machineinstrs -mtriple=riscv64-unknown-unknown | 
FileCheck %s  --check-prefixes=CHECK,64-BITS
+; RUN: llc < %s -verify-machineinstrs -mtriple=riscv32-unknown-unknown | 
FileCheck %s --check-prefixes=CHECK,32-BITS
+
+target triple = "riscv64-unknown-linux-gnu"
+
+define i32 @skip(i32 noundef %a, i32 noundef %b, i32 noundef %c) #0 
"zero-call-used-regs"="skip" {
+; 64-BITS-LABEL: skip:
+; 64-BITS:       # %bb.0: # %entry
+; 64-BITS-NEXT:    mulw a0, a1, a0
+; 64-BITS-NEXT:    or a0, a0, a2
+; 64-BITS-NEXT:    ret
+;
+; 32-BITS-LABEL: skip:
+; 32-BITS:       # %bb.0: # %entry
+; 32-BITS-NEXT:    mul a0, a1, a0
+; 32-BITS-NEXT:    or a0, a0, a2
+; 32-BITS-NEXT:    ret
+
+entry:
+  %mul = mul nsw i32 %b, %a
+  %or = or i32 %mul, %c
+  ret i32 %or
+}
+
+define i32 @used_gpr_arg(i32 noundef %a, i32 noundef %b, i32 noundef %c) #0 
"zero-call-used-regs"="used-gpr-arg" {
+; 64-BITS-LABEL: used_gpr_arg:
+; 64-BITS:       # %bb.0: # %entry
+; 64-BITS-NEXT:    mulw a0, a1, a0
+; 64-BITS-NEXT:    or a0, a0, a2
+; 64-BITS-NEXT:    li a1, 0
+; 64-BITS-NEXT:    li a2, 0
+; 64-BITS-NEXT:    ret
+;
+; 32-BITS-LABEL: used_gpr_arg:
+; 32-BITS:       # %bb.0: # %entry
+; 32-BITS-NEXT:    mul a0, a1, a0
+; 32-BITS-NEXT:    or a0, a0, a2
+; 32-BITS-NEXT:    li a1, 0
+; 32-BITS-NEXT:    li a2, 0
+; 32-BITS-NEXT:    ret
+
+entry:
+  %mul = mul nsw i32 %b, %a
+  %or = or i32 %mul, %c
+  ret i32 %or
+}
+
+define i32 @used_gpr(i32 noundef %a, i32 noundef %b, i32 noundef %c) #0 
"zero-call-used-regs"="used-gpr" {
+; 64-BITS-LABEL: used_gpr:
+; 64-BITS:       # %bb.0: # %entry
+; 64-BITS-NEXT:    mulw a0, a1, a0
+; 64-BITS-NEXT:    or a0, a0, a2
+; 64-BITS-NEXT:    li a1, 0
+; 64-BITS-NEXT:    li a2, 0
+; 64-BITS-NEXT:    ret
+;
+; 32-BITS-LABEL: used_gpr:
+; 32-BITS:       # %bb.0: # %entry
+; 32-BITS-NEXT:    mul a0, a1, a0
+; 32-BITS-NEXT:    or a0, a0, a2
+; 32-BITS-NEXT:    li a1, 0
+; 32-BITS-NEXT:    li a2, 0
+; 32-BITS-NEXT:    ret
+
+entry:
+  %mul = mul nsw i32 %b, %a
+  %or = or i32 %mul, %c
+  ret i32 %or
+}
+
+define i32 @used_arg(i32 noundef %a, i32 noundef %b, i32 noundef %c) #0 
"zero-call-used-regs"="used-arg" {
----------------
lenary wrote:

Can you add an unused arg to this, so we see it not being cleared?

https://github.com/llvm/llvm-project/pull/194883
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to