brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · eb35133 Raw
70 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt                        -passes=instcombine -S %s | FileCheck %s --check-prefix=NATURAL3; RUN: opt --data-layout="i16:32" -passes=instcombine -S %s | FileCheck %s --check-prefix=OVERALIGNED4 5; The data layouts are little endian, so @foo is 0x0123456789ABCDEF in memory.6@foo = constant <4 x i16> <i16 u0x2301, i16 u0x6745, i16 u0xAB89, i16 u0xEFCD>, align 87 8declare void @report(i64 %index, i8 %val)9 10define void @test_vector_load_i8() {11; Access and report each individual byte in @foo.12; OVERALIGNED and NATURAL should have the same result, because the layout of vectors ignores13; element type alignment, and thus the representation of @foo is the same in both cases.14; NATURAL-LABEL: @test_vector_load_i8(15; NATURAL-NEXT:    call void @report(i64 0, i8 1)16; NATURAL-NEXT:    call void @report(i64 1, i8 35)17; NATURAL-NEXT:    call void @report(i64 2, i8 69)18; NATURAL-NEXT:    call void @report(i64 3, i8 103)19; NATURAL-NEXT:    call void @report(i64 4, i8 -119)20; NATURAL-NEXT:    call void @report(i64 5, i8 -85)21; NATURAL-NEXT:    call void @report(i64 6, i8 -51)22; NATURAL-NEXT:    call void @report(i64 7, i8 -17)23; NATURAL-NEXT:    ret void24;25; OVERALIGNED-LABEL: @test_vector_load_i8(26; OVERALIGNED-NEXT:    call void @report(i64 0, i8 1)27; OVERALIGNED-NEXT:    call void @report(i64 1, i8 35)28; OVERALIGNED-NEXT:    call void @report(i64 2, i8 69)29; OVERALIGNED-NEXT:    call void @report(i64 3, i8 103)30; OVERALIGNED-NEXT:    call void @report(i64 4, i8 -119)31; OVERALIGNED-NEXT:    call void @report(i64 5, i8 -85)32; OVERALIGNED-NEXT:    call void @report(i64 6, i8 -51)33; OVERALIGNED-NEXT:    call void @report(i64 7, i8 -17)34; OVERALIGNED-NEXT:    ret void35;36  %ptr0 = getelementptr i8, ptr @foo, i64 037  %res0 = load i8, ptr %ptr0, align 138  call void @report(i64 0, i8 %res0)39 40  %ptr1 = getelementptr i8, ptr @foo, i64 141  %res1 = load i8, ptr %ptr1, align 142  call void @report(i64 1, i8 %res1)43 44  %ptr2 = getelementptr i8, ptr @foo, i64 245  %res2 = load i8, ptr %ptr2, align 146  call void @report(i64 2, i8 %res2)47 48  %ptr3 = getelementptr i8, ptr @foo, i64 349  %res3 = load i8, ptr %ptr3, align 150  call void @report(i64 3, i8 %res3)51 52  %ptr4 = getelementptr i8, ptr @foo, i64 453  %res4 = load i8, ptr %ptr4, align 154  call void @report(i64 4, i8 %res4)55 56  %ptr5 = getelementptr i8, ptr @foo, i64 557  %res5 = load i8, ptr %ptr5, align 158  call void @report(i64 5, i8 %res5)59 60  %ptr6 = getelementptr i8, ptr @foo, i64 661  %res6 = load i8, ptr %ptr6, align 162  call void @report(i64 6, i8 %res6)63 64  %ptr7 = getelementptr i8, ptr @foo, i64 765  %res7 = load i8, ptr %ptr7, align 166  call void @report(i64 7, i8 %res7)67 68  ret void69}70