Home | History | Annotate | Download | only in GlobalISel
      1 # RUN: llc -mtriple arm-linux-gnueabihf -mattr=+vfp4 -float-abi=hard -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix HARD
      2 # RUN: llc -mtriple arm-linux-gnueabihf -mattr=+vfp2 -float-abi=hard -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix SOFT -check-prefix HARD-ABI
      3 # RUN: llc -mtriple arm-linux-gnueabi -mattr=+vfp4,+soft-float -float-abi=soft -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix SOFT -check-prefix SOFT-ABI
      4 # RUN: llc -mtriple arm-linux-gnu -mattr=+vfp4,+soft-float -float-abi=soft -run-pass=legalizer %s -o - | FileCheck %s  -check-prefix CHECK -check-prefix SOFT -check-prefix SOFT-ABI
      5 --- |
      6   define void @test_fma_float() { ret void }
      7   define void @test_fma_double() { ret void }
      8 ...
      9 ---
     10 name:            test_fma_float
     11 # CHECK-LABEL: name: test_fma_float
     12 legalized:       false
     13 # CHECK: legalized: true
     14 regBankSelected: false
     15 selected:        false
     16 tracksRegLiveness: true
     17 registers:
     18   - { id: 0, class: _ }
     19   - { id: 1, class: _ }
     20   - { id: 2, class: _ }
     21   - { id: 3, class: _ }
     22 body:             |
     23   bb.0:
     24     liveins: $r0, $r1, $r2
     25 
     26     ; CHECK-DAG: [[X:%[0-9]+]]:_(s32) = COPY $r0
     27     ; CHECK-DAG: [[Y:%[0-9]+]]:_(s32) = COPY $r1
     28     ; CHECK-DAG: [[Z:%[0-9]+]]:_(s32) = COPY $r2
     29     %0(s32) = COPY $r0
     30     %1(s32) = COPY $r1
     31     %2(s32) = COPY $r2
     32     ; HARD: [[R:%[0-9]+]]:_(s32) = G_FMA [[X]], [[Y]], [[Z]]
     33     ; SOFT-NOT: G_FMA
     34     ; SOFT: ADJCALLSTACKDOWN
     35     ; SOFT-ABI-DAG: $r0 = COPY [[X]]
     36     ; SOFT-ABI-DAG: $r1 = COPY [[Y]]
     37     ; SOFT-ABI-DAG: $r2 = COPY [[Z]]
     38     ; SOFT-ABI: BL &fmaf, {{.*}}, implicit $r0, implicit $r1, implicit $r2, implicit-def $r0
     39     ; SOFT-ABI: [[R:%[0-9]+]]:_(s32) = COPY $r0
     40     ; HARD-ABI-DAG: $s0 = COPY [[X]]
     41     ; HARD-ABI-DAG: $s1 = COPY [[Y]]
     42     ; HARD-ABI-DAG: $s2 = COPY [[Z]]
     43     ; HARD-ABI: BL &fmaf, {{.*}}, implicit $s0, implicit $s1, implicit $s2, implicit-def $s0
     44     ; HARD-ABI: [[R:%[0-9]+]]:_(s32) = COPY $s0
     45     ; SOFT: ADJCALLSTACKUP
     46     ; SOFT-NOT: G_FMA
     47     %3(s32) = G_FMA %0, %1, %2
     48     ; CHECK: $r0 = COPY [[R]]
     49     $r0 = COPY %3(s32)
     50     BX_RET 14, $noreg, implicit $r0
     51 ...
     52 ---
     53 name:            test_fma_double
     54 # CHECK-LABEL: name: test_fma_double
     55 legalized:       false
     56 # CHECK: legalized: true
     57 regBankSelected: false
     58 selected:        false
     59 tracksRegLiveness: true
     60 registers:
     61   - { id: 0, class: _ }
     62   - { id: 1, class: _ }
     63   - { id: 2, class: _ }
     64   - { id: 3, class: _ }
     65   - { id: 4, class: _ }
     66   - { id: 5, class: _ }
     67   - { id: 6, class: _ }
     68   - { id: 7, class: _ }
     69   - { id: 8, class: _ }
     70 body:             |
     71   bb.0:
     72     liveins: $r0, $r1, $r2, $r3
     73 
     74     ; CHECK-DAG: [[X0:%[0-9]+]]:_(s32) = COPY $r0
     75     ; CHECK-DAG: [[X1:%[0-9]+]]:_(s32) = COPY $r1
     76     ; CHECK-DAG: [[Y0:%[0-9]+]]:_(s32) = COPY $r2
     77     ; CHECK-DAG: [[Y1:%[0-9]+]]:_(s32) = COPY $r3
     78     %0(s32) = COPY $r0
     79     %1(s32) = COPY $r1
     80     %2(s32) = COPY $r2
     81     %3(s32) = COPY $r3
     82     ; HARD-DAG: [[X:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[X0]]
     83     ; HARD-DAG: [[Y:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[Y0]]
     84     ; HARD-ABI-DAG: [[X:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[X0]]
     85     ; HARD-ABI-DAG: [[Y:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[Y0]]
     86     %4(s64) = G_MERGE_VALUES %0(s32), %1(s32)
     87     %5(s64) = G_MERGE_VALUES %2(s32), %3(s32)
     88     ; HARD: [[R:%[0-9]+]]:_(s64) = G_FMA [[X]], [[X]], [[Y]]
     89     ; SOFT-NOT: G_FMA
     90     ; SOFT: ADJCALLSTACKDOWN
     91     ; SOFT-ABI-DAG: $r{{[0-1]}} = COPY [[X0]]
     92     ; SOFT-ABI-DAG: $r{{[0-1]}} = COPY [[X1]]
     93     ; SOFT-ABI-DAG: $r{{[2-3]}} = COPY [[X0]]
     94     ; SOFT-ABI-DAG: $r{{[2-3]}} = COPY [[X1]]
     95     ; SOFT-ABI: [[SP1:%[0-9]+]]:_(p0) = COPY $sp
     96     ; SOFT-ABI: [[OFF1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
     97     ; SOFT-ABI: [[FI1:%[0-9]+]]:_(p0) = G_GEP [[SP1]], [[OFF1]](s32)
     98 
     99     ; FIXME: This ought to be align 8 but ARM's call lowering hardcodes it to 0
    100     ; SOFT-ABI: G_STORE [[Y0]](s32), [[FI1]](p0){{.*}}store 4 into stack, align 0)
    101     ; SOFT-ABI: [[OFF2:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
    102     ; SOFT-ABI: [[FI2:%[0-9]+]]:_(p0) = G_GEP [[FI1]], [[OFF2]](s32)
    103     ; SOFT-ABI: G_STORE [[Y1]](s32), [[FI2]](p0){{.*}}store 4 into stack + 4)
    104     ; SOFT-ABI: BL &fma, {{.*}}, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0, implicit-def $r1
    105     ; SOFT-ABI-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0
    106     ; SOFT-ABI-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1
    107     ; HARD-ABI-DAG: $d0 = COPY [[X]]
    108     ; HARD-ABI-DAG: $d1 = COPY [[X]]
    109     ; HARD-ABI-DAG: $d2 = COPY [[Y]]
    110     ; HARD-ABI: BL &fma, {{.*}}, implicit $d0, implicit $d1, implicit $d2, implicit-def $d0
    111     ; HARD-ABI: [[R:%[0-9]+]]:_(s64) = COPY $d0
    112     ; SOFT: ADJCALLSTACKUP
    113     ; SOFT-NOT: G_FMA
    114     %6(s64) = G_FMA %4, %4, %5
    115     ; HARD: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[R]](s64)
    116     ; HARD-ABI: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[R]](s64)
    117     %7(s32),%8(s32) = G_UNMERGE_VALUES %6(s64)
    118     ; CHECK-DAG: $r0 = COPY [[R0]]
    119     ; CHECK-DAG: $r1 = COPY [[R1]]
    120     $r0 = COPY %7(s32)
    121     $r1 = COPY %8(s32)
    122     BX_RET 14, $noreg, implicit $r0, implicit $r1
    123 ...
    124