Home | History | Annotate | Download | only in ARM
      1 ; Tests the genration of ".arch_extension" attribute for hardware
      2 ; division on krait CPU. For now, krait is recognized as "cortex-a9" + hwdiv
      3 ; Also, tests for the hwdiv instruction on krait CPU
      4 
      5 ; check for arch_extension/cpu directive
      6 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=krait | FileCheck %s --check-prefix=DIV_EXTENSION
      7 ; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi -mcpu=krait | FileCheck %s --check-prefix=DIV_EXTENSION
      8 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a9 | FileCheck %s --check-prefix=NODIV_KRAIT
      9 ; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi -mcpu=cortex-a9 | FileCheck %s --check-prefix=NODIV_KRAIT
     10 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=krait -mattr=-hwdiv,-hwdiv-arm | FileCheck %s --check-prefix=NODIV_KRAIT
     11 
     12 ; check if correct instruction is emitted by integrated assembler
     13 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=krait -filetype=obj | llvm-objdump -mcpu=krait -triple armv7-linux-gnueabi -d - | FileCheck %s --check-prefix=HWDIV
     14 ; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi -mcpu=krait -filetype=obj | llvm-objdump -mcpu=krait -triple thumbv7-linux-gnueabi -d - | FileCheck %s --check-prefix=HWDIV
     15 
     16 ; arch_extension attribute
     17 ; DIV_EXTENSION:  .cpu cortex-a9
     18 ; DIV_EXTENSION:  .arch_extension idiv
     19 ; NODIV_KRAIT-NOT:  .arch_extension idiv
     20 ; HWDIV: sdiv
     21 
     22 define i32 @main() #0 {
     23 entry:
     24   %retval = alloca i32, align 4
     25   %a = alloca i32, align 4
     26   %b = alloca i32, align 4
     27   %c = alloca i32, align 4
     28   store i32 0, i32* %retval
     29   store volatile i32 100, i32* %b, align 4
     30   store volatile i32 32, i32* %c, align 4
     31   %0 = load volatile i32, i32* %b, align 4
     32   %1 = load volatile i32, i32* %c, align 4
     33   %div = sdiv i32 %0, %1
     34   store volatile i32 %div, i32* %a, align 4
     35   ret i32 0
     36 }
     37