llvm/llvm/test/CodeGen/X86/large-constants-x32.ll

; 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 # imm = 0xEEBEEBEC
; CHECK-NEXT:    movl (%eax), %ecx
; CHECK-NEXT:    movl $-289477644, %edx # imm = 0xEEBEEBF4
; CHECK-NEXT:    movl (%edx), %edx
; CHECK-NEXT:    movl $-289477648, %esi # imm = 0xEEBEEBF0
; CHECK-NEXT:    addl (%esi), %ecx
; CHECK-NEXT:    movl $-289477636, %esi # imm = 0xEEBEEBFC
; CHECK-NEXT:    addl (%esi), %edx
; CHECK-NEXT:    addl %ecx, %edx
; CHECK-NEXT:    movl %edx, (%eax)
; CHECK-NEXT:    retq
entry:
  %0 = load i32, ptr inttoptr (i32 add (i32 -289477652, i32 0) to ptr)
  %1 = load i32, ptr inttoptr (i32 add (i32 -289477652, i32 4) to ptr)
  %2 = load i32, ptr inttoptr (i32 add (i32 -289477652, i32 8) to ptr)
  %3 = load i32, ptr inttoptr (i32 add (i32 -289477652, i32 16) to ptr)
  %4 = add i32 %0, %1
  %5 = add i32 %2, %3
  %6 = add i32 %4, %5
  store i32 %6, ptr inttoptr (i32 add (i32 -289477652, i32 0) to ptr)
  ret void
}


define void @constant_expressions2() {
; CHECK-LABEL: constant_expressions2:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    movl $-289477652, %eax # imm = 0xEEBEEBEC
; CHECK-NEXT:    movl (%eax), %ecx
; CHECK-NEXT:    movl $-289477644, %edx # imm = 0xEEBEEBF4
; CHECK-NEXT:    movl (%edx), %edx
; CHECK-NEXT:    movl $-289477648, %esi # imm = 0xEEBEEBF0
; CHECK-NEXT:    addl (%esi), %ecx
; CHECK-NEXT:    movl $-289477640, %esi # imm = 0xEEBEEBF8
; CHECK-NEXT:    addl (%esi), %edx
; CHECK-NEXT:    addl %ecx, %edx
; CHECK-NEXT:    movl %edx, (%eax)
; CHECK-NEXT:    retq
entry:
  %0 = load i32, ptr inttoptr (i32 -289477652 to ptr)
  %1 = load i32, ptr inttoptr (i32 -289477648 to ptr)
  %2 = load i32, ptr inttoptr (i32 -289477644 to ptr)
  %3 = load i32, ptr inttoptr (i32 -289477640 to ptr)
  %4 = add i32 %0, %1
  %5 = add i32 %2, %3
  %6 = add i32 %4, %5
  store i32 %6, ptr inttoptr (i32 -289477652 to ptr)
  ret void
}