21 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s | FileCheck %s3 4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"5target triple = "x86_64-unknown-linux-gnu"6 7; Test that a constant consisting of a global symbol with a negative offset8; is properly folded and isel'd.9 10@G = external dso_local global [8 x i32]11define ptr @negative_offset(ptr %a) {12; CHECK-LABEL: negative_offset:13; CHECK: # %bb.0:14; CHECK-NEXT: movl $G, %eax15; CHECK-NEXT: notq %rax16; CHECK-NEXT: addq %rdi, %rax17; CHECK-NEXT: retq18 %t = getelementptr i8, ptr %a, i64 sub (i64 -1, i64 ptrtoint (ptr @G to i64))19 ret ptr %t20}21