• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Show that we know how to translate mul.
2
3; NOTE: We use -O2 to get rid of memory stores.
4
5; REQUIRES: allow_dump
6
7; Compile using standalone assembler.
8; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 \
9; RUN:   | FileCheck %s --check-prefix=ASM
10
11; Show bytes in assembled standalone code.
12; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \
13; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
14
15; Compile using integrated assembler.
16; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \
17; RUN:   | FileCheck %s --check-prefix=IASM
18
19; Show bytes in assembled integrated code.
20; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
21; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
22
23define internal i32 @MulTwoRegs(i32 %a, i32 %b) {
24  %v = mul i32 %a, %b
25  ret i32 %v
26}
27
28; ASM-LABEL:MulTwoRegs:
29; DIS-LABEL:<MulTwoRegs>:
30; IASM-LABEL:MulTwoRegs:
31
32; ASM:          mul     r0, r0, r1
33; DIS:          e0000190
34; IASM-NOT:     mul
35
36define internal i64 @MulTwoI64Regs(i64 %a, i64 %b) {
37  %v = mul i64 %a, %b
38  ret i64 %v
39}
40
41; ASM-LABEL:MulTwoI64Regs:
42; DIS-LABEL:<MulTwoI64Regs>:
43; IASM-LABEL:MulTwoI64Regs:
44
45; ASM:          mul     r3, r0, r3
46; ASM-NEXT:     mla     r1, r2, r1, r3
47; ASM-NEXT:     # r3 = def.pseudo
48; ASM-NEXT:     umull   r0, r3, r0, r2
49; ASM-NEXT:     # r3 = def.pseudo r0
50; ASM-NEXT:     add     r3, r3, r1
51
52; DIS:          e0030390
53; DIS-NEXT:     e0213192
54; DIS-NEXT:     e0830290
55; DIS-NEXT:     e0833001
56
57; IASM-NOT:     mul
58; IASM-NOT:     mla
59; IASM-NOT:     umull
60; IASM-NOT:     add
61