Chromium Code Reviews| Index: tests_lit/assembler/arm32/store-sf.ll |
| diff --git a/tests_lit/assembler/arm32/store-sf.ll b/tests_lit/assembler/arm32/store-sf.ll |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e49bdbc1320e76674e0a27a1180a6f315c8f3cd5 |
| --- /dev/null |
| +++ b/tests_lit/assembler/arm32/store-sf.ll |
| @@ -0,0 +1,124 @@ |
| +; Sample program that generates "str reg, [fp, #CCCC]", to show that we |
|
Jim Stichnoth
2015/11/11 20:42:09
This test case seems vastly over-complicated. How
Karl
2015/11/11 22:42:57
Done.
Jim Stichnoth
2015/11/11 23:12:27
Could you add that comment to the function? Speci
|
| +; recognize that "fp" should be used instead of "sp". |
| + |
| +; REQUIRES: allow_dump |
| + |
| +; Compile using standalone assembler. |
| +; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -Om1 \ |
| +; RUN: -test-stack-extra=4088 | FileCheck %s --check-prefix=ASM |
| + |
| +; Show bytes in assembled standalone code. |
| +; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \ |
| +; RUN: --args -Om1 -test-stack-extra=4088 | FileCheck %s --check-prefix=DIS |
| + |
| +; Compile using integrated assembler. |
| +; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 \ |
| +; RUN: -test-stack-extra=4088 -unsafe-ias | FileCheck %s --check-prefix=IASM |
| + |
| +; Show bytes in assembled integrated code. |
| +; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \ |
| +; RUN: --args -Om1 -test-stack-extra=4088 -unsafe-ias \ |
| +; RUN: | FileCheck %s --check-prefix=DIS |
| + |
| +declare i8* @llvm.stacksave() |
| + |
| +declare void @llvm.stackrestore(i8*) |
| + |
| +define internal i32 @test_vla_in_loop(i32 %size, i32 %start, i32 %inc) { |
| +entry: |
| + %cmp34 = icmp ult i32 %start, %size |
| + br i1 %cmp34, label %for.body3.lr.ph, label %for.end16 |
| + |
| +; ASM-LABEL: test_vla_in_loop: |
| +; ASM-NEXT: .Ltest_vla_in_loop$entry: |
| +; ASM-NEXT: push {fp, lr} |
| +; ASM: mov fp, sp |
| +; ASM: movw ip, #4248 |
| +; ASM-NEXT: sub sp, sp, ip |
| +; ASM-NEXT: str r0, [fp, #-4092] |
| + |
| +; DIS-LABEL: 00000000 <test_vla_in_loop>: |
| +; DIS-NEXT: 0: e92d4800 |
| +; DIS-NEXT: 4: e1a0b00d |
| +; DIS-NEXT: 8: e301c098 |
| +; DIS-NEXT: c: e04dd00c |
| +; DIS-NEXT: 10: e50b0ffc |
| + |
| +; IASM-LABEL: test_vla_in_loop: |
| +; IASM-NEXT: .Ltest_vla_in_loop$entry: |
| +; IASM-NEXT: .byte 0x0 |
| +; IASM-NEXT: .byte 0x48 |
| +; IASM-NEXT: .byte 0x2d |
| +; IASM-NEXT: .byte 0xe9 |
| + |
| +; IASM-NEXT: .byte 0xd |
| +; IASM-NEXT: .byte 0xb0 |
| +; IASM-NEXT: .byte 0xa0 |
| +; IASM-NEXT: .byte 0xe1 |
| + |
| +; IASM-NEXT: movw ip, #4248 |
| +; IASM-NEXT: .byte 0xc |
| +; IASM-NEXT: .byte 0xd0 |
| +; IASM-NEXT: .byte 0x4d |
| +; IASM-NEXT: .byte 0xe0 |
| + |
| +; IASM-NEXT: .byte 0xfc |
| +; IASM-NEXT: .byte 0xf |
| +; IASM-NEXT: .byte 0xb |
| +; IASM-NEXT: .byte 0xe5 |
| + |
| +; NOTE: The remaining code is not tested. |
| + |
| +for.body3.lr.ph: ; preds = %entry, %for.end13 |
| + %sum.036 = phi i32 [ %add10.lcssa, %for.end13 ], [ 0, %entry ] |
| + %i.035 = phi i32 [ %inc15, %for.end13 ], [ %start, %entry ] |
| + %sub = sub i32 %size, %i.035 |
| + %0 = call i8* @llvm.stacksave() |
| + %vla.alloca_mul = mul i32 4, %sub |
| + %vla = alloca i8, i32 %vla.alloca_mul, align 4 |
| + %vla.asint = ptrtoint i8* %vla to i32 |
| + br label %for.body3 |
| + |
| + |
| +for.body3: ; preds = %for.body3.lr.ph, %for.body3 |
| + %j.030 = phi i32 [ 0, %for.body3.lr.ph ], [ %inc4, %for.body3 ] |
| + %mul = mul i32 %j.030, %start |
| + %add = add i32 %mul, %inc |
| + %call = call i32 @foo(i32 %add) |
| + %gep_array = mul i32 %j.030, 4 |
| + %gep = add i32 %vla.asint, %gep_array |
| + %gep.asptr = inttoptr i32 %gep to i32* |
| + store i32 %call, i32* %gep.asptr, align 1 |
| + %inc4 = add i32 %j.030, 1 |
| + %cmp2 = icmp ult i32 %inc4, %sub |
| + br i1 %cmp2, label %for.body3, label %for.body8 |
| + |
| +for.body8: ; preds = %for.body3, %for.body8 |
| + %j5.033 = phi i32 [ %inc12, %for.body8 ], [ 0, %for.body3 ] |
| + %sum.132 = phi i32 [ %add10, %for.body8 ], [ %sum.036, %for.body3 ] |
| + %gep_array2 = mul i32 %j5.033, 4 |
| + %gep3 = add i32 %vla.asint, %gep_array2 |
| + %gep3.asptr = inttoptr i32 %gep3 to i32* |
| + %1 = load i32, i32* %gep3.asptr, align 1 |
| + %add10 = add i32 %1, %sum.132 |
| + %inc12 = add i32 %j5.033, 1 |
| + %cmp7 = icmp ult i32 %inc12, %sub |
| + br i1 %cmp7, label %for.body8, label %for.end13 |
| + |
| +for.end13: ; preds = %for.body8 |
| + %add10.lcssa = phi i32 [ %add10, %for.body8 ] |
| + call void @llvm.stackrestore(i8* %0) |
| + %inc15 = add i32 %i.035, 1 |
| + %exitcond = icmp eq i32 %inc15, %size |
| + br i1 %exitcond, label %for.end16, label %for.body3.lr.ph |
| + |
| +for.end16: ; preds = %for.end13, %entry |
| + %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add10.lcssa, %for.end13 ] |
| + ret i32 %sum.0.lcssa |
| +} |
| + |
| +define internal i32 @foo(i32 %x) { |
| +entry: |
| + %mul = mul i32 %x, %x |
| + ret i32 %mul |
| +} |