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
5 target 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"
6 target triple = "x86_64-unknown-linux-gnu"
7 @data = external global [0 x i32] ; <[0 x i32]*> [#uses=5]
9 ; CHECK-TINY: Target does not support the tiny CodeModel
11 define i32 @foo() nounwind readonly {
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, i32* getelementptr ([0 x i32], [0 x i32]* @data, i64 0, i64 0), align 4 ; <i32> [#uses=1]
21 define i32 @foo1() nounwind readonly {
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, i32* getelementptr ([0 x i32], [0 x i32]* @data, i32 0, i64 4194303), align 4 ; <i32> [#uses=1]
31 define i32 @foo2() nounwind readonly {
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, i32* getelementptr ([0 x i32], [0 x i32]* @data, i32 0, i64 10), align 4 ; <i32> [#uses=1]
41 define i32 @foo3() nounwind readonly {
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, i32* getelementptr ([0 x i32], [0 x i32]* @data, i32 0, i64 -10), align 4 ; <i32> [#uses=1]
52 define i32 @foo4() nounwind readonly {
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, i32* getelementptr ([0 x i32], [0 x i32]* @data, i32 0, i64 4194304), align 4 ; <i32> [#uses=1]
64 define i32 @foo5() nounwind readonly {
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, i32* getelementptr ([0 x i32], [0 x i32]* @data, i32 0, i64 -4194304), align 4 ; <i32> [#uses=1]