1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 ; Test that a constant consisting of a global symbol with a negative offset
8 ; is properly folded and isel'd.
10 @G = external dso_local global [8 x i32]
11 define ptr @negative_offset(ptr %a) {
12 ; CHECK-LABEL: negative_offset:
14 ; CHECK-NEXT: movl $G, %eax
15 ; CHECK-NEXT: notq %rax
16 ; CHECK-NEXT: addq %rdi, %rax
18 %t = getelementptr i8, ptr %a, i64 sub (i64 -1, i64 ptrtoint (ptr @G to i64))