1; RUN: llc < %s -code-model=small | FileCheck -check-prefix CHECK-SMALL %s 2; RUN: llc < %s -code-model=kernel | FileCheck -check-prefix CHECK-KERNEL %s 3; RUN: not llc < %s -code-model=tiny 2>&1 | FileCheck -check-prefix CHECK-TINY %s 4 5target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" 6target triple = "x86_64-unknown-linux-gnu" 7@data = external dso_local global [0 x i32] ; <ptr> [#uses=5] 8 9; CHECK-TINY: Target does not support the tiny CodeModel 10 11define i32 @foo() nounwind readonly { 12entry: 13; CHECK-SMALL-LABEL: foo: 14; CHECK-SMALL: movl data(%rip), %eax 15; CHECK-KERNEL-LABEL: foo: 16; CHECK-KERNEL: movl data(%rip), %eax 17 %0 = load i32, ptr @data, align 4 ; <i32> [#uses=1] 18 ret i32 %0 19} 20 21define i32 @foo1() nounwind readonly { 22entry: 23; CHECK-SMALL-LABEL: foo1: 24; CHECK-SMALL: movl data+16777212(%rip), %eax 25; CHECK-KERNEL-LABEL: foo1: 26; CHECK-KERNEL: movl data+16777212(%rip), %eax 27 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 4194303), align 4 ; <i32> [#uses=1] 28 ret i32 %0 29} 30 31define i32 @foo2() nounwind readonly { 32entry: 33; CHECK-SMALL-LABEL: foo2: 34; CHECK-SMALL: movl data+40(%rip), %eax 35; CHECK-KERNEL-LABEL: foo2: 36; CHECK-KERNEL: movl data+40(%rip), %eax 37 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 10), align 4 ; <i32> [#uses=1] 38 ret i32 %0 39} 40 41define i32 @foo3() nounwind readonly { 42entry: 43; CHECK-SMALL-LABEL: foo3: 44; CHECK-SMALL: movl data-40(%rip), %eax 45; CHECK-KERNEL-LABEL: foo3: 46; CHECK-KERNEL: movq $-40, %rax 47; CHECK-KERNEL: movl data(%rax), %eax 48 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 -10), align 4 ; <i32> [#uses=1] 49 ret i32 %0 50} 51 52define i32 @foo4() nounwind readonly { 53entry: 54; FIXME: We really can use movabsl here! 55; CHECK-SMALL-LABEL: foo4: 56; CHECK-SMALL: movl $16777216, %eax 57; CHECK-SMALL: movl data(%rax), %eax 58; CHECK-KERNEL-LABEL: foo4: 59; CHECK-KERNEL: movl data+16777216(%rip), %eax 60 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 4194304), align 4 ; <i32> [#uses=1] 61 ret i32 %0 62} 63 64define i32 @foo5() nounwind readonly { 65entry: 66; CHECK-SMALL-LABEL: foo5: 67; CHECK-SMALL: movl data-16777216(%rip), %eax 68; CHECK-KERNEL-LABEL: foo5: 69; CHECK-KERNEL: movq $-16777216, %rax 70; CHECK-KERNEL: movl data(%rax), %eax 71 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 -4194304), align 4 ; <i32> [#uses=1] 72 ret i32 %0 73} 74