1 ; RUN: llc -verify-machineinstrs -code-model=small < %s | FileCheck %s
2 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-v128:128:128-n32:64"
3 target triple = "powerpc64-unknown-linux-gnu"
5 @double_array = global [32 x double] zeroinitializer, align 8
6 @number64 = global i64 10, align 8
7 @internal_static_var.x = internal unnamed_addr global i64 0, align 8
9 define i64 @access_int64(i64 %a) nounwind readonly {
11 ; CHECK-LABEL: access_int64:
12 ; CHECK-NEXT: .p2align 3
13 ; CHECK-NEXT: .quad .L[[BEGIN:.*]]
14 ; CHECK-NEXT: .quad .TOC.@tocbase
17 ; CHECK-NEXT: .L[[BEGIN]]:
18 %0 = load i64, i64* @number64, align 8
19 ; CHECK: ld {{[0-9]+}}, .LC{{[0-9]+}}@toc(2)
20 %cmp = icmp eq i64 %0, %a
21 %conv1 = zext i1 %cmp to i64
25 define i64 @internal_static_var(i64 %a) nounwind {
27 ; CHECK-LABEL: internal_static_var:
28 ; CHECK: ld {{[0-9]+}}, .LC{{[0-9]+}}@toc(2)
29 %0 = load i64, i64* @internal_static_var.x, align 8
30 %cmp = icmp eq i64 %0, %a
31 %conv1 = zext i1 %cmp to i64
35 define i32 @access_double(double %a) nounwind readnone {
37 ; CHECK-LABEL: access_double:
38 ; CHECK: ld {{[0-9]+}}, .LC{{[0-9]+}}@toc(2)
39 %cmp = fcmp oeq double %a, 2.000000e+00
40 %conv = zext i1 %cmp to i32
45 define i32 @access_double_array(double %a, i32 %i) nounwind readonly {
47 ; CHECK-LABEL: access_double_array:
48 %idxprom = sext i32 %i to i64
49 %arrayidx = getelementptr inbounds [32 x double], [32 x double]* @double_array, i64 0, i64 %idxprom
50 %0 = load double, double* %arrayidx, align 8
51 ; CHECK: ld {{[0-9]+}}, .LC{{[0-9]+}}@toc(2)
52 %cmp = fcmp oeq double %0, %a
53 %conv = zext i1 %cmp to i32
57 ; Check the creation of 4 .tc entries:
58 ; * int64_t global 'number64'
59 ; * double constant 2.0
60 ; * double array 'double_array'
61 ; * static int64_t 'x' accessed within '@internal_static_var'
62 ; CHECK: .LC{{[0-9]+}}:
63 ; CHECK-NEXT: .tc {{[\._a-zA-Z0-9]+}}[TC],{{[\._a-zA-Z0-9]+}}
64 ; CHECK-NEXT: .LC{{[0-9]+}}:
65 ; CHECK-NEXT: .tc {{[\._a-zA-Z0-9]+}}[TC],{{[\._a-zA-Z0-9]+}}
66 ; CHECK-NEXT: .LC{{[0-9]+}}:
67 ; CHECK-NEXT: .tc {{[\._a-zA-Z0-9]+}}[TC],{{[\._a-zA-Z0-9]+}}
68 ; CHECK-NEXT: .LC{{[0-9]+}}:
69 ; CHECK-NEXT: .tc {{[\._a-zA-Z0-9]+}}[TC],{{[\._a-zA-Z0-9]+}}