brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 79166cf Raw
92 lines · plain
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--5 6 7; Test big index trunc to pointer size:8 9define ptr @test_trunc65(ptr %ptr) nounwind {10; CHECK-LABEL: test_trunc6511; CHECK: 312  %d = getelementptr i8, ptr %ptr, i65 18446744073709551619 ; 2^64 + 313  ret ptr %d14}15 16define ptr @test_trunc128(ptr %ptr) nounwind {17; CHECK-LABEL: test_trunc12818; CHECK: 519  %d = getelementptr i8, ptr %ptr, i128 18446744073709551621 ; 2^64 + 520  ret ptr %d21}22 23define ptr @test_trunc160(ptr %ptr) nounwind {24; CHECK-LABEL: test_trunc16025; CHECK: 826  %d = getelementptr i8, ptr %ptr, i160 18446744073709551624 ; 2^64 + 827  ret ptr %d28}29 30define ptr @test_trunc256(ptr %ptr) nounwind {31; CHECK-LABEL: test_trunc25632; CHECK: 1333  %d = getelementptr i8, ptr %ptr, i256 18446744073709551629 ; 2^64 + 1334  ret ptr %d35}36 37define ptr @test_trunc2048(ptr %ptr) nounwind {38; CHECK-LABEL: test_trunc204839; CHECK: 2140  %d = getelementptr i8, ptr %ptr, i2048 18446744073709551637 ; 2^64 + 2141  ret ptr %d42}43 44 45; Test small index sext to pointer size46 47define ptr @test_sext3(ptr %ptr) nounwind {48; CHECK-LABEL: test_sext349; CHECK: -350  %d = getelementptr i8, ptr %ptr, i3 -351  ret ptr %d52}53 54define ptr @test_sext5(ptr %ptr) nounwind {55; CHECK-LABEL: test_sext556; CHECK: -557  %d = getelementptr i8, ptr %ptr, i5 -558  ret ptr %d59}60 61define ptr @test_sext8(ptr %ptr) nounwind {62; CHECK-LABEL: test_sext863; CHECK: -864  %d = getelementptr i8, ptr %ptr, i8 -865  ret ptr %d66}67 68define ptr @test_sext13(ptr %ptr) nounwind {69; CHECK-LABEL: test_sext1370; CHECK: -1371  %d = getelementptr i8, ptr %ptr, i8 -1372  ret ptr %d73}74 75define ptr @test_sext16(ptr %ptr) nounwind {76; CHECK-LABEL: test_sext1677; CHECK: -2178  %d = getelementptr i8, ptr %ptr, i8 -2179  ret ptr %d80}81 82 83; Test out of int64_t range indices84 85; OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=717386define void @test_outofrange(ptr %ptr) nounwind {87; CHECK-LABEL: test_outofrange88  %d = getelementptr i96, ptr %ptr, i96 3961408125713216879677197516789  %ld = load i96, ptr %d, align 190  unreachable91}92