1 ; RUN: llc < %s -O0 -mtriple=i686--
2 ; RUN: llc < %s -O0 -mtriple=x86_64--
3 ; RUN: llc < %s -O2 -mtriple=i686--
4 ; RUN: llc < %s -O2 -mtriple=x86_64--
7 ; Test big index trunc to pointer size:
9 define ptr @test_trunc65(ptr %ptr) nounwind {
10 ; CHECK-LABEL: test_trunc65
12 %d = getelementptr i8, ptr %ptr, i65 18446744073709551619 ; 2^64 + 3
16 define ptr @test_trunc128(ptr %ptr) nounwind {
17 ; CHECK-LABEL: test_trunc128
19 %d = getelementptr i8, ptr %ptr, i128 18446744073709551621 ; 2^64 + 5
23 define ptr @test_trunc160(ptr %ptr) nounwind {
24 ; CHECK-LABEL: test_trunc160
26 %d = getelementptr i8, ptr %ptr, i160 18446744073709551624 ; 2^64 + 8
30 define ptr @test_trunc256(ptr %ptr) nounwind {
31 ; CHECK-LABEL: test_trunc256
33 %d = getelementptr i8, ptr %ptr, i256 18446744073709551629 ; 2^64 + 13
37 define ptr @test_trunc2048(ptr %ptr) nounwind {
38 ; CHECK-LABEL: test_trunc2048
40 %d = getelementptr i8, ptr %ptr, i2048 18446744073709551637 ; 2^64 + 21
45 ; Test small index sext to pointer size
47 define ptr @test_sext3(ptr %ptr) nounwind {
48 ; CHECK-LABEL: test_sext3
50 %d = getelementptr i8, ptr %ptr, i3 -3
54 define ptr @test_sext5(ptr %ptr) nounwind {
55 ; CHECK-LABEL: test_sext5
57 %d = getelementptr i8, ptr %ptr, i5 -5
61 define ptr @test_sext8(ptr %ptr) nounwind {
62 ; CHECK-LABEL: test_sext8
64 %d = getelementptr i8, ptr %ptr, i8 -8
68 define ptr @test_sext13(ptr %ptr) nounwind {
69 ; CHECK-LABEL: test_sext13
71 %d = getelementptr i8, ptr %ptr, i8 -13
75 define ptr @test_sext16(ptr %ptr) nounwind {
76 ; CHECK-LABEL: test_sext16
78 %d = getelementptr i8, ptr %ptr, i8 -21
83 ; Test out of int64_t range indices
85 ; OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7173
86 define void @test_outofrange(ptr %ptr) nounwind {
87 ; CHECK-LABEL: test_outofrange
88 %d = getelementptr i96, ptr %ptr, i96 39614081257132168796771975167
89 %ld = load i96, ptr %d, align 1