Home | History | Annotate | Download | only in arm32
      1 ; Show that we know how to translate udiv
      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 -mattr=hwdiv-arm \
      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 -mattr=hwdiv-arm | FileCheck %s --check-prefix=DIS
     14 
     15 ; Compile using integrated assembler.
     16 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 -mattr=hwdiv-arm \
     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 -mattr=hwdiv-arm \
     22 ; RUN:   | FileCheck %s --check-prefix=DIS
     23 
     24 define internal i32 @UdivTwoRegs(i32 %a, i32 %b) {
     25   %v = udiv i32 %a, %b
     26   ret i32 %v
     27 }
     28 
     29 ; ASM-LABEL:UdivTwoRegs:
     30 ; ASM-NEXT:.LUdivTwoRegs$__0:
     31 ; ASM-NEXT:     tst     r1, r1
     32 ; ASM-NEXT:     bne     .LUdivTwoRegs$local$__0
     33 ; ASM-NEXT:     .long 0xe7fedef0
     34 ; ASM-NEXT:.LUdivTwoRegs$local$__0:
     35 ; ASM-NEXT:     udiv    r0, r0, r1
     36 ; ASM-NEXT:     bx      lr
     37 
     38 ; DIS-LABEL:00000000 <UdivTwoRegs>:
     39 ; DIS-NEXT:   0:        e1110001
     40 ; DIS-NEXT:   4:        1a000000
     41 ; DIS-NEXT:   8:        e7fedef0
     42 ; DIS-NEXT:   c:        e730f110
     43 ; DIS-NEXT:  10:        e12fff1e
     44 
     45 ; IASM-LABEL:UdivTwoRegs:
     46 ; IASM-NEXT:.LUdivTwoRegs$__0:
     47 
     48 ; IASM-NEXT:    .byte 0x1
     49 ; IASM-NEXT:    .byte 0x0
     50 ; IASM-NEXT:    .byte 0x11
     51 ; IASM-NEXT:    .byte 0xe1
     52 
     53 ; IASM-NEXT:    .byte 0x0
     54 ; IASM-NEXT:    .byte 0x0
     55 ; IASM-NEXT:    .byte 0x0
     56 ; IASM-NEXT:    .byte 0x1a
     57 
     58 ; IASM-NEXT:    .byte 0xf0
     59 ; IASM-NEXT:    .byte 0xde
     60 ; IASM-NEXT:    .byte 0xfe
     61 ; IASM-NEXT:    .byte 0xe7
     62 
     63 ; IASM-NEXT:.LUdivTwoRegs$local$__0:
     64 ; IASM-NEXT:    .byte 0x10
     65 ; IASM-NEXT:    .byte 0xf1
     66 ; IASM-NEXT:    .byte 0x30
     67 ; IASM-NEXT:    .byte 0xe7
     68 
     69 ; IASM-NEXT:    .byte 0x1e
     70 ; IASM-NEXT:    .byte 0xff
     71 ; IASM-NEXT:    .byte 0x2f
     72 ; IASM-NEXT:    .byte 0xe1
     73