74 lines · plain
1; RUN: llc < %s -code-model=small | FileCheck -check-prefix CHECK-SMALL %s2; RUN: llc < %s -code-model=kernel | FileCheck -check-prefix CHECK-KERNEL %s3; RUN: not llc < %s -code-model=tiny 2>&1 | FileCheck -check-prefix CHECK-TINY %s4 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: LLVM ERROR: target does not support the tiny CodeModel10 11define i32 @foo() nounwind readonly {12entry:13; CHECK-SMALL-LABEL: foo:14; CHECK-SMALL: movl data(%rip), %eax15; CHECK-KERNEL-LABEL: foo:16; CHECK-KERNEL: movl data(%rip), %eax17 %0 = load i32, ptr @data, align 4 ; <i32> [#uses=1]18 ret i32 %019}20 21define i32 @foo1() nounwind readonly {22entry:23; CHECK-SMALL-LABEL: foo1:24; CHECK-SMALL: movl data+16777212(%rip), %eax25; CHECK-KERNEL-LABEL: foo1:26; CHECK-KERNEL: movl data+16777212(%rip), %eax27 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 4194303), align 4 ; <i32> [#uses=1]28 ret i32 %029}30 31define i32 @foo2() nounwind readonly {32entry:33; CHECK-SMALL-LABEL: foo2:34; CHECK-SMALL: movl data+40(%rip), %eax35; CHECK-KERNEL-LABEL: foo2:36; CHECK-KERNEL: movl data+40(%rip), %eax37 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 10), align 4 ; <i32> [#uses=1]38 ret i32 %039}40 41define i32 @foo3() nounwind readonly {42entry:43; CHECK-SMALL-LABEL: foo3:44; CHECK-SMALL: movl data-40(%rip), %eax45; CHECK-KERNEL-LABEL: foo3:46; CHECK-KERNEL: movq $-40, %rax47; CHECK-KERNEL: movl data(%rax), %eax48 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 -10), align 4 ; <i32> [#uses=1]49 ret i32 %050}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, %eax57; CHECK-SMALL: movl data(%rax), %eax58; CHECK-KERNEL-LABEL: foo4:59; CHECK-KERNEL: movl data+16777216(%rip), %eax60 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 4194304), align 4 ; <i32> [#uses=1]61 ret i32 %062}63 64define i32 @foo5() nounwind readonly {65entry:66; CHECK-SMALL-LABEL: foo5:67; CHECK-SMALL: movl data-16777216(%rip), %eax68; CHECK-KERNEL-LABEL: foo5:69; CHECK-KERNEL: movq $-16777216, %rax70; CHECK-KERNEL: movl data(%rax), %eax71 %0 = load i32, ptr getelementptr ([0 x i32], ptr @data, i32 0, i64 -4194304), align 4 ; <i32> [#uses=1]72 ret i32 %073}74