Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: tests_lit/assembler/arm32/ldr-shift.ll

Issue 1486263002: More coverage of load/stores in ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix remaining issue in patch set 2. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests_lit/assembler/arm32/branch-mult-fwd.ll ('k') | tests_lit/assembler/arm32/ldr-str-more.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; Show that we know how to translate LDR (register). 1 ; Show that we know how to translate LDR/LDRH (register) instructions.
2 2
3 ; NOTE: We use -O2 to get rid of memory stores. 3 ; NOTE: We use -O2 to get rid of memory stores.
4 4
5 ; REQUIRES: allow_dump 5 ; REQUIRES: allow_dump
6 6
7 ; Compile using standalone assembler. 7 ; Compile using standalone assembler.
8 ; RUN: %lc2i --filetype=asm -i %s --target=arm32 --args -O2 \ 8 ; RUN: %lc2i --filetype=asm -i %s --target=arm32 --args -O2 \
9 ; RUN: | FileCheck %s --check-prefix=ASM 9 ; RUN: | FileCheck %s --check-prefix=ASM
10 10
11 ; Show bytes in assembled standalone code. 11 ; Show bytes in assembled standalone code.
12 ; RUN: %lc2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \ 12 ; RUN: %lc2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \
13 ; RUN: --args -O2 | FileCheck %s --check-prefix=DIS 13 ; RUN: --args -O2 | FileCheck %s --check-prefix=DIS
14 14
15 ; Compile using integrated assembler. 15 ; Compile using integrated assembler.
16 ; RUN: %lc2i --filetype=iasm -i %s --target=arm32 --args -O2 \ 16 ; RUN: %lc2i --filetype=iasm -i %s --target=arm32 --args -O2 \
17 ; RUN: | FileCheck %s --check-prefix=IASM 17 ; RUN: | FileCheck %s --check-prefix=IASM
18 18
19 ; Show bytes in assembled integrated code. 19 ; Show bytes in assembled integrated code.
20 ; RUN: %lc2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \ 20 ; RUN: %lc2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
21 ; RUN: --args -O2 | FileCheck %s --check-prefix=DIS 21 ; RUN: --args -O2 | FileCheck %s --check-prefix=DIS
22 22
23 ; Define some global arrays to access.
23 @ArrayInitPartial = internal global [40 x i8] c"<\00\00\00F\00\00\00P\00\00\00Z\ 00\00\00d\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", align 4 24 @ArrayInitPartial = internal global [40 x i8] c"<\00\00\00F\00\00\00P\00\00\00Z\ 00\00\00d\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", align 4
24 25
25 @NumArraysElements = internal global [4 x i8] c"\01\00\00\00", align 4
26
27 @Arrays = internal constant <{ i32, [4 x i8] }> <{ i32 ptrtoint ([40 x i8]* @Arr ayInitPartial to i32), [4 x i8] c"\14\00\00\00" }>, align 4 26 @Arrays = internal constant <{ i32, [4 x i8] }> <{ i32 ptrtoint ([40 x i8]* @Arr ayInitPartial to i32), [4 x i8] c"\14\00\00\00" }>, align 4
28 27
29 define internal void @_Z8getArrayjRj(i32 %WhichArray, i32 %Len) { 28 ; Index elements of an array.
30 ; ASM-LABEL:_Z8getArrayjRj: 29 define internal i32 @IndexArray(i32 %WhichArray, i32 %Len) {
31 ; DIS-LABEL:00000000 <_Z8getArrayjRj>: 30 ; ASM-LABEL:IndexArray:
32 ; IASM-LABEL:_Z8getArrayjRj: 31 ; DIS-LABEL:00000000 <IndexArray>:
32 ; IASM-LABEL:IndexArray:
33 33
34 entry: 34 entry:
35 ; ASM-NEXT:.L_Z8getArrayjRj$entry: 35 ; ASM-NEXT:.LIndexArray$entry:
36 ; IASM-NEXT:.L_Z8getArrayjRj$entry: 36 ; IASM-NEXT:.LIndexArray$entry:
37 37
38 %gep_array = mul i32 %WhichArray, 8 38 %gep_array = mul i32 %WhichArray, 8
39
40 ; ASM-NEXT: push {r4}
41 ; DIS-NEXT: 0: e52d4004
42 ; IASM-NEXT: .byte 0x4
43 ; IASM-NEXT: .byte 0x40
44 ; IASM-NEXT: .byte 0x2d
45 ; IASM-NEXT: .byte 0xe5
46
47 ; ASM-NEXT: lsl r2, r0, #3
48 ; DIS-NEXT: 4: e1a02180
49 ; IASM-NEXT: .byte 0x80
50 ; IASM-NEXT: .byte 0x21
51 ; IASM-NEXT: .byte 0xa0
52 ; IASM-NEXT: .byte 0xe1
53
39 %expanded1 = ptrtoint <{ i32, [4 x i8] }>* @Arrays to i32 54 %expanded1 = ptrtoint <{ i32, [4 x i8] }>* @Arrays to i32
40 %gep = add i32 %expanded1, %gep_array 55 %gep = add i32 %expanded1, %gep_array
41 56
42 ; ASM-NEXT: movw r2, #:lower16:Arrays 57 ; ASM-NEXT: movw r3, #:lower16:Arrays
43 ; ASM-NEXT: movt r2, #:upper16:Arrays 58 ; DIS-NEXT: 8: e3003000
44 ; DIS-NEXT: 0: e3002000 59 ; IASM-NEXT: movw r3, #:lower16:Arrays @ .word e3003000
45 ; DIS-NEXT: 4: e3402000 60
46 ; IASM-NEXT:» movw» r2, #:lower16:Arrays» @ .word e3002000 61 ; ASM-NEXT: movt r3, #:upper16:Arrays
47 ; IASM-NEXT:» movt» r2, #:upper16:Arrays» @ .word e3402000 62 ; DIS-NEXT: c: e3403000
63 ; IASM-NEXT: movt r3, #:upper16:Arrays @ .word e3403000
48 64
49 %gep3 = add i32 %gep, 4 65 %gep3 = add i32 %gep, 4
50 66
51 ; ASM-NEXT: add r2, r2, #4 67 ; ASM-NEXT: add r4, r3, #4
52 ; DIS-NEXT: 8: e2822004 68 ; DIS-NEXT: 10: e2834004
53 ; IASM-NEXT:» .byte 0x4 69 ; IASM-NEXT: .byte 0x4
54 ; IASM-NEXT:» .byte 0x20 70 ; IASM-NEXT: .byte 0x40
55 ; IASM-NEXT:» .byte 0x82 71 ; IASM-NEXT: .byte 0x83
56 ; IASM-NEXT:» .byte 0xe2 72 ; IASM-NEXT: .byte 0xe2
57 73
58 ; ***** Here is the use of a LDR (register) instruction. 74 ; ***** Here is the use of a LDR (register) instruction.
59 %gep3.asptr = inttoptr i32 %gep3 to i32* 75 %gep3.asptr = inttoptr i32 %gep3 to i32*
60 %v1 = load i32, i32* %gep3.asptr, align 1 76 %v1 = load i32, i32* %gep3.asptr, align 1
61 77
62 ; ASM-NEXT: ldr r2, [r2, r0, lsl #3] 78 ; ASM-NEXT: ldr r4, [r4, r0, lsl #3]
63 ; DIS-NEXT: c: e7922180 79 ; DIS-NEXT: 14: e7944180
64 ; IASM-NEXT:» .byte 0x80 80 ; IASM-NEXT: .byte 0x80
65 ; IASM-NEXT:» .byte 0x21 81 ; IASM-NEXT: .byte 0x41
66 ; IASM-NEXT:» .byte 0x92 82 ; IASM-NEXT: .byte 0x94
67 ; IASM-NEXT:» .byte 0xe7 83 ; IASM-NEXT: .byte 0xe7
68
69 84
70 %Len.asptr3 = inttoptr i32 %Len to i32* 85 %Len.asptr3 = inttoptr i32 %Len to i32*
71 store i32 %v1, i32* %Len.asptr3, align 1 86 store i32 %v1, i32* %Len.asptr3, align 1
72 87
73 ; ASM-NEXT: str r2, [r1] 88 ; ASM-NEXT: str r4, [r1]
74 ; DIS-NEXT: 10: e5812000 89 ; DIS-NEXT: 18: e5814000
75 ; IASM-NEXT:» .byte 0x0 90 ; IASM-NEXT: .byte 0x0
76 ; IASM-NEXT:» .byte 0x20 91 ; IASM-NEXT: .byte 0x40
77 ; IASM-NEXT:» .byte 0x81 92 ; IASM-NEXT: .byte 0x81
78 ; IASM-NEXT:» .byte 0xe5 93 ; IASM-NEXT: .byte 0xe5
79 94
80 ret void 95 ; Now read the value as an i16 to test ldrh (register).
96 %gep3.i16ptr = inttoptr i32 %gep3 to i16*
97 %v16 = load i16, i16* %gep3.i16ptr, align 1
81 98
82 ; ASM-NEXT: bx lr 99 ; ASM-NEXT: add r3, r3, #4
83 ; DIS-NEXT: 14: e12fff1e 100 ; DIS-NEXT: 1c: e2833004
84 ; IASM-NEXT:» .byte 0x1e 101 ; IASM-NEXT: .byte 0x4
85 ; IASM-NEXT:» .byte 0xff 102 ; IASM-NEXT: .byte 0x30
86 ; IASM-NEXT:» .byte 0x2f 103 ; IASM-NEXT: .byte 0x83
87 ; IASM-NEXT:» .byte 0xe1 104 ; IASM-NEXT: .byte 0xe2
88 105
106 ; ***** Here is the use of a LDRH (register) instruction.
107 ; ASM-NEXT: ldrh r3, [r3, r2]
108 ; DIS-NEXT: 20: e19330b2
109 ; IASM-NEXT: .byte 0xb2
110 ; IASM-NEXT: .byte 0x30
111 ; IASM-NEXT: .byte 0x93
112 ; IASM-NEXT: .byte 0xe1
113
114 %ret = sext i16 %v16 to i32
115 ret i32 %ret
89 } 116 }
OLDNEW
« no previous file with comments | « tests_lit/assembler/arm32/branch-mult-fwd.ll ('k') | tests_lit/assembler/arm32/ldr-str-more.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698