[llvm] 3b7dfda - [X86] Add test cases for gnux32 large constants Issue #55061
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 04:31:17 PDT 2023
Author: Simon Pilgrim
Date: 2023-09-20T12:24:51+01:00
New Revision: 3b7dfda79de2f9b0d14099bda9280ea1607f9f26
URL: https://github.com/llvm/llvm-project/commit/3b7dfda79de2f9b0d14099bda9280ea1607f9f26
DIFF: https://github.com/llvm/llvm-project/commit/3b7dfda79de2f9b0d14099bda9280ea1607f9f26.diff
LOG: [X86] Add test cases for gnux32 large constants Issue #55061
Test file showing current codegen for D124406
Added:
llvm/test/CodeGen/X86/large-constants-x32.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/large-constants-x32.ll b/llvm/test/CodeGen/X86/large-constants-x32.ll
new file mode 100644
index 000000000000000..e875920b8b7054e
--- /dev/null
+++ b/llvm/test/CodeGen/X86/large-constants-x32.ll
@@ -0,0 +1,47 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s
+
+define void @constant_expressions() {
+; CHECK-LABEL: constant_expressions:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: movl -289477652, %eax
+; CHECK-NEXT: movl -289477644, %ecx
+; CHECK-NEXT: addl -289477648, %eax
+; CHECK-NEXT: addl -289477636, %ecx
+; CHECK-NEXT: addl %eax, %ecx
+; CHECK-NEXT: movl %ecx, -289477652
+; CHECK-NEXT: retq
+entry:
+ %0 = load i32, i32* inttoptr (i32 add (i32 -289477652, i32 0) to i32*)
+ %1 = load i32, i32* inttoptr (i32 add (i32 -289477652, i32 4) to i32*)
+ %2 = load i32, i32* inttoptr (i32 add (i32 -289477652, i32 8) to i32*)
+ %3 = load i32, i32* inttoptr (i32 add (i32 -289477652, i32 16) to i32*)
+ %4 = add i32 %0, %1
+ %5 = add i32 %2, %3
+ %6 = add i32 %4, %5
+ store i32 %6, i32* inttoptr (i32 add (i32 -289477652, i32 0) to i32*)
+ ret void
+}
+
+
+define void @constant_expressions2() {
+; CHECK-LABEL: constant_expressions2:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: movl -289477652, %eax
+; CHECK-NEXT: movl -289477644, %ecx
+; CHECK-NEXT: addl -289477648, %eax
+; CHECK-NEXT: addl -289477640, %ecx
+; CHECK-NEXT: addl %eax, %ecx
+; CHECK-NEXT: movl %ecx, -289477652
+; CHECK-NEXT: retq
+entry:
+ %0 = load i32, i32* inttoptr (i32 -289477652 to i32*)
+ %1 = load i32, i32* inttoptr (i32 -289477648 to i32*)
+ %2 = load i32, i32* inttoptr (i32 -289477644 to i32*)
+ %3 = load i32, i32* inttoptr (i32 -289477640 to i32*)
+ %4 = add i32 %0, %1
+ %5 = add i32 %2, %3
+ %6 = add i32 %4, %5
+ store i32 %6, i32* inttoptr (i32 -289477652 to i32*)
+ ret void
+}
More information about the llvm-commits
mailing list