• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test the UXTB and UXTH instructions.
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 @_Z7testAddhh(i32 %a, i32 %b) {
24; ASM-LABEL: _Z7testAddhh:
25; DIS-LABEL: 00000000 <_Z7testAddhh>:
26; IASM-LABEL: _Z7testAddhh:
27
28entry:
29
30; ASM-NEXT: .L_Z7testAddhh$entry:
31; IASM-NEXT: .L_Z7testAddhh$entry:
32
33  %a.arg_trunc = trunc i32 %a to i8
34  %conv = zext i8 %a.arg_trunc to i32
35
36; ASM-NEXT:     uxtb    r0, r0
37; DIS-NEXT:    0:       e6ef0070
38; IASM-NEXT:    .byte 0x70
39; IASM-NEXT:    .byte 0x0
40; IASM-NEXT:    .byte 0xef
41; IASM-NEXT:    .byte 0xe6
42
43  %b.arg_trunc = trunc i32 %b to i8
44  %conv1 = zext i8 %b.arg_trunc to i32
45
46; ASM-NEXT:     uxtb    r1, r1
47; DIS-NEXT:    4:       e6ef1071
48; IASM-NEXT:    .byte 0x71
49; IASM-NEXT:    .byte 0x10
50; IASM-NEXT:    .byte 0xef
51; IASM-NEXT:    .byte 0xe6
52
53  %add = add i32 %conv1, %conv
54
55; ASM-NEXT:     add     r1, r1, r0
56; DIS-NEXT:    8:       e0811000
57; IASM-NEXT:    .byte 0x0
58; IASM-NEXT:    .byte 0x10
59; IASM-NEXT:    .byte 0x81
60; IASM-NEXT:    .byte 0xe0
61
62  %conv2 = trunc i32 %add to i16
63  %conv2.ret_ext = zext i16 %conv2 to i32
64
65; ASM-NEXT:     uxth    r1, r1
66; DIS-NEXT:   c:        e6ff1071
67; IASM-NEXT:    .byte 0x71
68; IASM-NEXT:    .byte 0x10
69; IASM-NEXT:    .byte 0xff
70; IASM-NEXT:    .byte 0xe6
71
72  ret i32 %conv2.ret_ext
73
74; ASM-NEXT:     mov     r0, r1
75; DIS-NEXT:   10:       e1a00001
76; IASM-NEXT:    .byte 0x1
77; IASM-NEXT:    .byte 0x0
78; IASM-NEXT:    .byte 0xa0
79; IASM-NEXT:    .byte 0xe1
80
81
82; ASM-NEXT:     bx      lr
83; DIS-NEXT:   14:       e12fff1e
84; IASM-NEXT:    .byte 0x1e
85; IASM-NEXT:    .byte 0xff
86; IASM-NEXT:    .byte 0x2f
87; IASM-NEXT:    .byte 0xe1
88
89}
90