Skip to content

[NFC][GISel][AArch64] Pre-commit baseline tests for translation of @llvm.expect.with.probability #117842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

antangelo
Copy link
Contributor

Pre-commit of tests for generic GlobalISel translation of @llvm.expect.with.probability for when optimizations are not enabled

@llvmbot
Copy link
Member

llvmbot commented Nov 27, 2024

@llvm/pr-subscribers-backend-aarch64

@llvm/pr-subscribers-llvm-globalisel

Author: None (antangelo)

Changes

Pre-commit of tests for generic GlobalISel translation of @<!-- -->llvm.expect.with.probability for when optimizations are not enabled


Full diff: https://github.com/llvm/llvm-project/pull/117842.diff

1 Files Affected:

  • (modified) llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-no-op-intrinsics.ll (+48-28)
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-no-op-intrinsics.ll b/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-no-op-intrinsics.ll
index 674ef9f1cffa7e..88828950353a7e 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-no-op-intrinsics.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-no-op-intrinsics.ll
@@ -4,26 +4,42 @@
 define i64 @expect_i64(i64 %arg0) {
   ; CHECK-LABEL: name: expect_i64
   ; CHECK: bb.1 (%ir-block.0):
-  ; CHECK:   liveins: $x0
-  ; CHECK:   [[COPY:%[0-9]+]]:_(s64) = COPY $x0
-  ; CHECK:   [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
-  ; CHECK:   $x0 = COPY [[COPY1]](s64)
-  ; CHECK:   RET_ReallyLR implicit $x0
+  ; CHECK-NEXT:   liveins: $x0
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:_(s64) = COPY $x0
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
+  ; CHECK-NEXT:   $x0 = COPY [[COPY1]](s64)
+  ; CHECK-NEXT:   RET_ReallyLR implicit $x0
   %expval = call i64 @llvm.expect.i64(i64 %arg0, i64 1)
   ret i64 %expval
 }
 
+define i64 @expect_with_probability_i64(i64 %arg0) {
+  ; CHECK-LABEL: name: expect_with_probability_i64
+  ; CHECK: bb.1 (%ir-block.0):
+  ; CHECK-NEXT:   liveins: $x0
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:_(s64) = COPY $x0
+  ; CHECK-NEXT:   [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
+  ; CHECK-NEXT:   [[INT:%[0-9]+]]:_(s64) = G_INTRINSIC intrinsic(@llvm.expect.with.probability), [[COPY]](s64), [[C]](s64), double 5.000000e-01
+  ; CHECK-NEXT:   $x0 = COPY [[INT]](s64)
+  ; CHECK-NEXT:   RET_ReallyLR implicit $x0
+  %expval = call i64 @llvm.expect.with.probability.i64(i64 %arg0, i64 1, double 0.5)
+  ret i64 %expval
+}
+
 define ptr @ptr_annotate(ptr %arg0, ptr %arg1, ptr %arg2, i32 %arg3) {
   ; CHECK-LABEL: name: ptr_annotate
   ; CHECK: bb.1 (%ir-block.0):
-  ; CHECK:   liveins: $w3, $x0, $x1, $x2
-  ; CHECK:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
-  ; CHECK:   [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
-  ; CHECK:   [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
-  ; CHECK:   [[COPY3:%[0-9]+]]:_(s32) = COPY $w3
-  ; CHECK:   [[COPY4:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
-  ; CHECK:   $x0 = COPY [[COPY4]](p0)
-  ; CHECK:   RET_ReallyLR implicit $x0
+  ; CHECK-NEXT:   liveins: $w3, $x0, $x1, $x2
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
+  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
+  ; CHECK-NEXT:   [[COPY3:%[0-9]+]]:_(s32) = COPY $w3
+  ; CHECK-NEXT:   [[COPY4:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
+  ; CHECK-NEXT:   $x0 = COPY [[COPY4]](p0)
+  ; CHECK-NEXT:   RET_ReallyLR implicit $x0
   %call = call ptr @llvm.ptr.annotation.p0(ptr %arg0, ptr %arg1, ptr %arg2, i32 %arg3, ptr null)
   ret ptr %call
 }
@@ -34,11 +50,12 @@ define ptr @ptr_annotate(ptr %arg0, ptr %arg1, ptr %arg2, i32 %arg3) {
 define i32 @annotation(i32 %a) {
   ; CHECK-LABEL: name: annotation
   ; CHECK: bb.1 (%ir-block.0):
-  ; CHECK:   liveins: $w0
-  ; CHECK:   [[COPY:%[0-9]+]]:_(s32) = COPY $w0
-  ; CHECK:   [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
-  ; CHECK:   $w0 = COPY [[COPY1]](s32)
-  ; CHECK:   RET_ReallyLR implicit $w0
+  ; CHECK-NEXT:   liveins: $w0
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:_(s32) = COPY $w0
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
+  ; CHECK-NEXT:   $w0 = COPY [[COPY1]](s32)
+  ; CHECK-NEXT:   RET_ReallyLR implicit $w0
   %call = call i32 @llvm.annotation.i32(i32 %a, ptr @.str, ptr @.str1, i32 2)
   ret i32 %call
 }
@@ -46,11 +63,12 @@ define i32 @annotation(i32 %a) {
 define ptr @launder_invariant_group(ptr %p) {
   ; CHECK-LABEL: name: launder_invariant_group
   ; CHECK: bb.1 (%ir-block.0):
-  ; CHECK:   liveins: $x0
-  ; CHECK:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
-  ; CHECK:   [[COPY1:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
-  ; CHECK:   $x0 = COPY [[COPY1]](p0)
-  ; CHECK:   RET_ReallyLR implicit $x0
+  ; CHECK-NEXT:   liveins: $x0
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
+  ; CHECK-NEXT:   $x0 = COPY [[COPY1]](p0)
+  ; CHECK-NEXT:   RET_ReallyLR implicit $x0
   %q = call ptr @llvm.launder.invariant.group.p0(ptr %p)
   ret ptr %q
 }
@@ -58,16 +76,18 @@ define ptr @launder_invariant_group(ptr %p) {
 define ptr @strip_invariant_group(ptr %p) {
   ; CHECK-LABEL: name: strip_invariant_group
   ; CHECK: bb.1 (%ir-block.0):
-  ; CHECK:   liveins: $x0
-  ; CHECK:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
-  ; CHECK:   [[COPY1:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
-  ; CHECK:   $x0 = COPY [[COPY1]](p0)
-  ; CHECK:   RET_ReallyLR implicit $x0
+  ; CHECK-NEXT:   liveins: $x0
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
+  ; CHECK-NEXT:   $x0 = COPY [[COPY1]](p0)
+  ; CHECK-NEXT:   RET_ReallyLR implicit $x0
   %q = call ptr @llvm.strip.invariant.group.p0(ptr %p)
   ret ptr %q
 }
 
 declare i64 @llvm.expect.i64(i64, i64) #0
+declare i64 @llvm.expect.with.probability.i64(i64, i64, double) #0
 declare ptr @llvm.ptr.annotation.p0(ptr, ptr, ptr, i32, ptr) #1
 declare i32 @llvm.annotation.i32(i32, ptr, ptr, i32) #1
 declare ptr @llvm.launder.invariant.group.p0(ptr) #2

@antangelo antangelo merged commit 512defe into llvm:main Nov 27, 2024
8 of 10 checks passed
@antangelo antangelo deleted the test-precommit-gisel-llvm-expect-probability branch November 27, 2024 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants