• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -O0 -march=x86
2; RUN: llc < %s -O0 -march=x86-64
3; RUN: llc < %s -O2 -march=x86
4; RUN: llc < %s -O2 -march=x86-64
5
6
7; Test big index trunc to pointer size:
8
9define i8* @test_trunc65(i8* %ptr) nounwind {
10; CHECK-LABEL: test_trunc65
11; CHECK: 3
12  %d = getelementptr i8, i8* %ptr, i65 18446744073709551619 ; 2^64 + 3
13  ret i8* %d
14}
15
16define i8* @test_trunc128(i8* %ptr) nounwind {
17; CHECK-LABEL: test_trunc128
18; CHECK: 5
19  %d = getelementptr i8, i8* %ptr, i128 18446744073709551621 ; 2^64 + 5
20  ret i8* %d
21}
22
23define i8* @test_trunc160(i8* %ptr) nounwind {
24; CHECK-LABEL: test_trunc160
25; CHECK: 8
26  %d = getelementptr i8, i8* %ptr, i160 18446744073709551624 ; 2^64 + 8
27  ret i8* %d
28}
29
30define i8* @test_trunc256(i8* %ptr) nounwind {
31; CHECK-LABEL: test_trunc256
32; CHECK: 13
33  %d = getelementptr i8, i8* %ptr, i256 18446744073709551629 ; 2^64 + 13
34  ret i8* %d
35}
36
37define i8* @test_trunc2048(i8* %ptr) nounwind {
38; CHECK-LABEL: test_trunc2048
39; CHECK: 21
40  %d = getelementptr i8, i8* %ptr, i2048 18446744073709551637 ; 2^64 + 21
41  ret i8* %d
42}
43
44
45; Test small index sext to pointer size
46
47define i8* @test_sext3(i8* %ptr) nounwind {
48; CHECK-LABEL: test_sext3
49; CHECK: -3
50  %d = getelementptr i8, i8* %ptr, i3 -3
51  ret i8* %d
52}
53
54define i8* @test_sext5(i8* %ptr) nounwind {
55; CHECK-LABEL: test_sext5
56; CHECK: -5
57  %d = getelementptr i8, i8* %ptr, i5 -5
58  ret i8* %d
59}
60
61define i8* @test_sext8(i8* %ptr) nounwind {
62; CHECK-LABEL: test_sext8
63; CHECK: -8
64  %d = getelementptr i8, i8* %ptr, i8 -8
65  ret i8* %d
66}
67
68define i8* @test_sext13(i8* %ptr) nounwind {
69; CHECK-LABEL: test_sext13
70; CHECK: -13
71  %d = getelementptr i8, i8* %ptr, i8 -13
72  ret i8* %d
73}
74
75define i8* @test_sext16(i8* %ptr) nounwind {
76; CHECK-LABEL: test_sext16
77; CHECK: -21
78  %d = getelementptr i8, i8* %ptr, i8 -21
79  ret i8* %d
80}
81