• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Show that we know how to translate mls.
2
3; REQUIRES: allow_dump
4
5; Compile using standalone assembler.
6; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -Om1 --mattr=hwdiv-arm \
7; RUN:   | FileCheck %s --check-prefix=ASM
8
9; Show bytes in assembled standalone code.
10; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \
11; RUN:   --args -Om1 --mattr=hwdiv-arm | FileCheck %s --check-prefix=DIS
12
13; Compile using integrated assembler.
14; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 --mattr=hwdiv-arm \
15; RUN:   | FileCheck %s --check-prefix=IASM
16
17; Show bytes in assembled integrated code.
18; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
19; RUN:   --args -Om1 --mattr=hwdiv-arm | FileCheck %s --check-prefix=DIS
20
21define internal i32 @testMls(i32 %a, i32 %b) {
22; ASM-LABEL: testMls:
23; DIS-LABEL: 00000000 <testMls>:
24; IASM-LABEL: testMls:
25
26entry:
27; ASM-NEXT: .LtestMls$entry:
28; IASM-NEXT: .LtestMls$entry:
29
30; ASM-NEXT:     sub     sp, sp, #12
31; DIS-NEXT:    0:       e24dd00c
32; IASM-NEXT:    .byte 0xc
33; IASM-NEXT:    .byte 0xd0
34; IASM-NEXT:    .byte 0x4d
35; IASM-NEXT:    .byte 0xe2
36
37; ASM-NEXT:     str     r0, [sp, #8]
38; ASM-NEXT:     # [sp, #8] = def.pseudo
39; DIS-NEXT:    4:       e58d0008
40; IASM-NEXT:    .byte 0x8
41; IASM-NEXT:    .byte 0x0
42; IASM-NEXT:    .byte 0x8d
43; IASM-NEXT:    .byte 0xe5
44
45; ASM-NEXT:     str     r1, [sp, #4]
46; ASM-NEXT:     # [sp, #4] = def.pseudo
47; DIS-NEXT:    8:       e58d1004
48; IASM-NEXT:    .byte 0x4
49; IASM-NEXT:    .byte 0x10
50; IASM-NEXT:    .byte 0x8d
51; IASM-NEXT:    .byte 0xe5
52
53  %rem = srem i32 %a, %b
54
55; ASM-NEXT:     ldr     r0, [sp, #8]
56; DIS-NEXT:    c:       e59d0008
57; IASM-NEXT:    .byte 0x8
58; IASM-NEXT:    .byte 0x0
59; IASM-NEXT:    .byte 0x9d
60; IASM-NEXT:    .byte 0xe5
61
62; ASM-NEXT:     ldr     r1, [sp, #4]
63; DIS-NEXT:   10:       e59d1004
64; IASM-NEXT:    .byte 0x4
65; IASM-NEXT:    .byte 0x10
66; IASM-NEXT:    .byte 0x9d
67; IASM-NEXT:    .byte 0xe5
68
69; ASM-NEXT:    tst     r1, r1
70; DIS-NEXT:   14:       e1110001
71; IASM-NEXT:    .byte 0x1
72; IASM-NEXT:    .byte 0x0
73; IASM-NEXT:    .byte 0x11
74; IASM-NEXT:    .byte 0xe1
75
76; ASM-NEXT:     bne     .LtestMls$local$__0
77; DIS-NEXT:   18:       1a000000
78; IASM-NEXT:    .byte 0x0
79; IASM-NEXT:    .byte 0x0
80; IASM-NEXT:    .byte 0x0
81; IASM-NEXT:    .byte 0x1a
82
83; ASM-NEXT:     .long 0xe7fedef0
84; DIS-NEXT:   1c:       e7fedef0
85; IASM-NEXT:    .byte 0xf0
86; IASM-NEXT:    .byte 0xde
87; IASM-NEXT:    .byte 0xfe
88; IASM-NEXT:    .byte 0xe7
89
90; ASM-NEXT: .LtestMls$local$__0:
91; IASM-NEXT: .LtestMls$local$__0:
92
93; ASM-NEXT:     ldr     r1, [sp, #4]
94; DIS-NEXT:   20:       e59d1004
95; IASM-NEXT:    .byte 0x4
96; IASM-NEXT:    .byte 0x10
97; IASM-NEXT:    .byte 0x9d
98; IASM-NEXT:    .byte 0xe5
99
100; ASM-NEXT:     sdiv    r2, r0, r1
101; DIS-NEXT:   24:       e712f110
102; IASM-NEXT:    .byte 0x10
103; IASM-NEXT:    .byte 0xf1
104; IASM-NEXT:    .byte 0x12
105; IASM-NEXT:    .byte 0xe7
106
107; ASM-NEXT:     mls     r0, r2, r1, r0
108; DIS-NEXT:   28:       e0600192
109; IASM-NEXT:    .byte 0x92
110; IASM-NEXT:    .byte 0x1
111; IASM-NEXT:    .byte 0x60
112; IASM-NEXT:    .byte 0xe0
113
114  ret i32 %rem
115}
116