Skip to content

Conversation

@arsenm
Copy link
Contributor

@arsenm arsenm commented Dec 12, 2025

No description provided.

@arsenm arsenm added the floating-point Floating-point math label Dec 12, 2025 — with Graphite App
Copy link
Contributor Author

arsenm commented Dec 12, 2025

@arsenm arsenm added the llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes label Dec 12, 2025 — with Graphite App
@arsenm arsenm requested a review from dtcxzyw December 12, 2025 09:06
@arsenm arsenm marked this pull request as ready for review December 12, 2025 09:06
@llvmbot
Copy link
Member

llvmbot commented Dec 12, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Matt Arsenault (arsenm)

Changes

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

1 Files Affected:

  • (modified) llvm/test/Transforms/InstCombine/ldexp.ll (+80)
diff --git a/llvm/test/Transforms/InstCombine/ldexp.ll b/llvm/test/Transforms/InstCombine/ldexp.ll
index 8908d476b4a2c..72997eef4fd6d 100644
--- a/llvm/test/Transforms/InstCombine/ldexp.ll
+++ b/llvm/test/Transforms/InstCombine/ldexp.ll
@@ -827,6 +827,86 @@ define float @ldexp_127(float %x) {
   ret float %ldexp
 }
 
+define float @ldexp_128(float %x) {
+; CHECK-LABEL: define float @ldexp_128
+; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-NEXT:    [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 128)
+; CHECK-NEXT:    ret float [[LDEXP]]
+;
+  %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 128)
+  ret float %ldexp
+}
+
+define float @ldexp_254(float %x) {
+; CHECK-LABEL: define float @ldexp_254
+; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-NEXT:    [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 254)
+; CHECK-NEXT:    ret float [[LDEXP]]
+;
+  %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 254)
+  ret float %ldexp
+}
+
+define float @ldexp_255(float %x) {
+; CHECK-LABEL: define float @ldexp_255
+; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-NEXT:    [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 255)
+; CHECK-NEXT:    ret float [[LDEXP]]
+;
+  %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 255)
+  ret float %ldexp
+}
+
+define float @ldexp_256(float %x) {
+; CHECK-LABEL: define float @ldexp_256
+; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-NEXT:    [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 256)
+; CHECK-NEXT:    ret float [[LDEXP]]
+;
+  %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 256)
+  ret float %ldexp
+}
+
+define float @ldexp_neg254(float %x) {
+; CHECK-LABEL: define float @ldexp_neg254
+; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-NEXT:    [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 -254)
+; CHECK-NEXT:    ret float [[LDEXP]]
+;
+  %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 -254)
+  ret float %ldexp
+}
+
+define float @ldexp_neg255(float %x) {
+; CHECK-LABEL: define float @ldexp_neg255
+; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-NEXT:    [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 -255)
+; CHECK-NEXT:    ret float [[LDEXP]]
+;
+  %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 -255)
+  ret float %ldexp
+}
+
+define float @ldexp_neg256(float %x) {
+; CHECK-LABEL: define float @ldexp_neg256
+; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-NEXT:    [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 -256)
+; CHECK-NEXT:    ret float [[LDEXP]]
+;
+  %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 -256)
+  ret float %ldexp
+}
+
+define float @ldexp_neg260(float %x) {
+; CHECK-LABEL: define float @ldexp_neg260
+; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-NEXT:    [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 -260)
+; CHECK-NEXT:    ret float [[LDEXP]]
+;
+  %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 -260)
+  ret float %ldexp
+}
+
 define <2 x float> @ldexp_3_vector(<2 x float> %x) {
 ; CHECK-LABEL: define <2 x float> @ldexp_3_vector
 ; CHECK-SAME: (<2 x float> [[X:%.*]]) {

@arsenm arsenm merged commit 975bda0 into main Dec 12, 2025
16 checks passed
@arsenm arsenm deleted the users/arsenm/instcombine/add-more-ldexp-constant-tests branch December 12, 2025 11:55
anonymouspc pushed a commit to anonymouspc/llvm that referenced this pull request Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

floating-point Floating-point math llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants