• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Show that we know how to translate rev (used in bswap).
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
23declare i16 @llvm.bswap.i16(i16)
24
25define internal i32 @testRev(i32 %a) {
26; ASM-LABEL:testRev:
27; DIS-LABEL:00000000 <testRev>:
28; IASM-LABEL:testRev:
29
30entry:
31; ASM-NEXT:.LtestRev$entry:
32; IASM-NEXT:.LtestRev$entry:
33
34  %a.arg_trunc = trunc i32 %a to i16
35  %v = tail call i16 @llvm.bswap.i16(i16 %a.arg_trunc)
36
37; ***** Example of rev instruction. *****
38; ASM-NEXT:     rev     r0, r0
39; DIS-NEXT:   0:        e6bf0f30
40; IASM-NEXT:    .byte 0x30
41; IASM-NEXT:    .byte 0xf
42; IASM-NEXT:    .byte 0xbf
43; IASM-NEXT:    .byte 0xe6
44
45; ASM-NEXT:     lsr     r0, r0, #16
46
47  %.ret_ext = zext i16 %v to i32
48  ret i32 %.ret_ext
49}
50