[llvm] eeac894 - Precommit tests for D132115

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 02:58:25 PDT 2022


Author: wanglian
Date: 2022-08-18T17:58:15+08:00
New Revision: eeac8944180e338754ffce585ae4a2e1f1deeb21

URL: https://github.com/llvm/llvm-project/commit/eeac8944180e338754ffce585ae4a2e1f1deeb21
DIFF: https://github.com/llvm/llvm-project/commit/eeac8944180e338754ffce585ae4a2e1f1deeb21.diff

LOG: Precommit tests for D132115

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D132116

Added: 
    

Modified: 
    llvm/test/CodeGen/AArch64/sve-vscale-combine.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AArch64/sve-vscale-combine.ll b/llvm/test/CodeGen/AArch64/sve-vscale-combine.ll
index 7ef9259bf7a57..1ebe91f329b38 100644
--- a/llvm/test/CodeGen/AArch64/sve-vscale-combine.ll
+++ b/llvm/test/CodeGen/AArch64/sve-vscale-combine.ll
@@ -71,6 +71,25 @@ define i32 @combine_sub_vscale_i32(i32 %in) nounwind {
  ret i32 %sub
 }
 
+; Tests of multiple uses of vscale when canonicalize
+; (sub X, (vscale * C)) to (add X,  (vscale * -C))
+define i64 @multiple_uses_sub_vscale_i64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: multiple_uses_sub_vscale_i64:
+; CHECK-NEXT:  rdvl	x8, #1
+; CHECK-NEXT:  rdvl	x9, #-1
+; CHECK-NEXT:  lsr	x8, x8, #4
+; CHECK-NEXT:  asr	x9, x9, #4
+; CHECK-NEXT:  add	x9, x0, x9
+; CHECK-NEXT:  add	x8, x1, x8
+; CHECK-NEXT:  mul	x0, x9, x8
+; CHECK-NEXT:  ret
+ %vscale = call i64 @llvm.vscale.i64()
+ %sub = sub i64 %x, %vscale
+ %add = add i64 %y, %vscale
+ %res = mul i64 %sub, %add
+ ret i64 %res
+}
+
 ; Fold (shl (vscale * C0), C1) to (vscale * (C0 << C1)).
 ; C0 = 1 , C1 = 4
 ; At IR level,  %shl = 2^4 * VSCALE.


        


More information about the llvm-commits mailing list