2014-04-04 00:01:44 +08:00
|
|
|
; RUN: llc -mtriple=arm-eabi -mattr=+vfp2 %s -o - | FileCheck %s -check-prefix=VFP2
|
|
|
|
; RUN: llc -mtriple=arm-eabi -mattr=+neon %s -o - | FileCheck %s -check-prefix=NEON
|
|
|
|
; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a8 %s -o - | FileCheck %s -check-prefix=A8
|
|
|
|
; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a9 %s -o - | FileCheck %s -check-prefix=A9
|
|
|
|
; RUN: llc -mtriple=arm-linux-gnueabi -mcpu=cortex-a9 -float-abi=hard %s -o - | FileCheck %s -check-prefix=HARD
|
2018-09-24 20:02:50 +08:00
|
|
|
; RUN: llc -mtriple=arm-linux-gnueabi -mcpu=cortex-m4 -float-abi=hard %s -o - | FileCheck %s -check-prefix=VMLA
|
|
|
|
; RUN: llc -mtriple=arm-linux-gnueabi -mcpu=cortex-m33 -float-abi=hard %s -o - | FileCheck %s -check-prefix=VMLA
|
2009-08-05 01:53:06 +08:00
|
|
|
|
2010-11-13 04:32:20 +08:00
|
|
|
define float @t1(float %acc, float %a, float %b) {
|
2009-08-05 01:53:06 +08:00
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; VFP2-LABEL: t1:
|
2010-11-13 04:32:20 +08:00
|
|
|
; VFP2: vmla.f32
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; NEON-LABEL: t1:
|
2010-11-13 04:32:20 +08:00
|
|
|
; NEON: vmla.f32
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; A8-LABEL: t1:
|
2010-11-13 04:32:20 +08:00
|
|
|
; A8: vmul.f32
|
|
|
|
; A8: vadd.f32
|
2018-09-24 20:02:50 +08:00
|
|
|
|
|
|
|
; VMLA-LABEL: t1:
|
|
|
|
; VMLA: vmul.f32
|
|
|
|
; VMLA-NEXT: vadd.f32
|
|
|
|
|
|
|
|
%0 = fmul float %a, %b
|
|
|
|
%1 = fadd float %acc, %0
|
|
|
|
ret float %1
|
|
|
|
}
|
|
|
|
|
2018-10-17 15:26:35 +08:00
|
|
|
define float @vmla_minsize(float %acc, float %a, float %b) #0 {
|
2018-09-24 20:02:50 +08:00
|
|
|
entry:
|
2018-10-17 15:26:35 +08:00
|
|
|
; VMLA-LABEL: vmla_minsize:
|
|
|
|
; VMLA: vmla.f32 s0, s1, s2
|
|
|
|
; VMLA-NEXT: bx lr
|
2018-09-24 20:02:50 +08:00
|
|
|
|
2018-02-02 19:51:06 +08:00
|
|
|
%0 = fmul float %a, %b
|
|
|
|
%1 = fadd float %acc, %0
|
2009-08-05 01:53:06 +08:00
|
|
|
ret float %1
|
|
|
|
}
|
|
|
|
|
2010-11-13 04:32:20 +08:00
|
|
|
define double @t2(double %acc, double %a, double %b) {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; VFP2-LABEL: t2:
|
2010-11-13 04:32:20 +08:00
|
|
|
; VFP2: vmla.f64
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; NEON-LABEL: t2:
|
2010-11-13 04:32:20 +08:00
|
|
|
; NEON: vmla.f64
|
2009-11-22 22:23:33 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; A8-LABEL: t2:
|
2010-11-13 04:32:20 +08:00
|
|
|
; A8: vmul.f64
|
|
|
|
; A8: vadd.f64
|
2018-02-02 19:51:06 +08:00
|
|
|
%0 = fmul double %a, %b
|
|
|
|
%1 = fadd double %acc, %0
|
2010-11-13 04:32:20 +08:00
|
|
|
ret double %1
|
|
|
|
}
|
2009-11-22 22:23:33 +08:00
|
|
|
|
2010-11-13 04:32:20 +08:00
|
|
|
define float @t3(float %acc, float %a, float %b) {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; VFP2-LABEL: t3:
|
2010-11-13 04:32:20 +08:00
|
|
|
; VFP2: vmla.f32
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; NEON-LABEL: t3:
|
2010-11-13 04:32:20 +08:00
|
|
|
; NEON: vmla.f32
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; A8-LABEL: t3:
|
2010-11-13 04:32:20 +08:00
|
|
|
; A8: vmul.f32
|
|
|
|
; A8: vadd.f32
|
2018-02-02 19:51:06 +08:00
|
|
|
%0 = fmul float %a, %b
|
|
|
|
%1 = fadd float %0, %acc
|
2010-11-13 04:32:20 +08:00
|
|
|
ret float %1
|
|
|
|
}
|
2011-04-20 02:11:57 +08:00
|
|
|
|
|
|
|
; It's possible to make use of fp vmla / vmls on Cortex-A9.
|
|
|
|
; rdar://8659675
|
|
|
|
define void @t4(float %acc1, float %a, float %b, float %acc2, float %c, float* %P1, float* %P2) {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; A8-LABEL: t4:
|
2011-04-20 02:11:57 +08:00
|
|
|
; A8: vmul.f32
|
|
|
|
; A8: vmul.f32
|
|
|
|
; A8: vadd.f32
|
|
|
|
; A8: vadd.f32
|
|
|
|
|
|
|
|
; Two vmla with now RAW hazard
|
2013-07-14 14:24:09 +08:00
|
|
|
; A9-LABEL: t4:
|
2011-04-20 02:11:57 +08:00
|
|
|
; A9: vmla.f32
|
|
|
|
; A9: vmla.f32
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; HARD-LABEL: t4:
|
2011-04-20 02:11:57 +08:00
|
|
|
; HARD: vmla.f32 s0, s1, s2
|
|
|
|
; HARD: vmla.f32 s3, s1, s4
|
|
|
|
%0 = fmul float %a, %b
|
|
|
|
%1 = fadd float %acc1, %0
|
|
|
|
%2 = fmul float %a, %c
|
|
|
|
%3 = fadd float %acc2, %2
|
|
|
|
store float %1, float* %P1
|
|
|
|
store float %3, float* %P2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @t5(float %a, float %b, float %c, float %d, float %e) {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; A8-LABEL: t5:
|
2011-04-20 02:11:57 +08:00
|
|
|
; A8: vmul.f32
|
|
|
|
; A8: vmul.f32
|
|
|
|
; A8: vadd.f32
|
|
|
|
; A8: vadd.f32
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; A9-LABEL: t5:
|
2011-04-20 02:11:57 +08:00
|
|
|
; A9: vmla.f32
|
|
|
|
; A9: vmul.f32
|
|
|
|
; A9: vadd.f32
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; HARD-LABEL: t5:
|
2011-04-20 02:11:57 +08:00
|
|
|
; HARD: vmla.f32 s4, s0, s1
|
|
|
|
; HARD: vmul.f32 s0, s2, s3
|
|
|
|
; HARD: vadd.f32 s0, s4, s0
|
|
|
|
%0 = fmul float %a, %b
|
|
|
|
%1 = fadd float %e, %0
|
|
|
|
%2 = fmul float %c, %d
|
|
|
|
%3 = fadd float %1, %2
|
|
|
|
ret float %3
|
|
|
|
}
|
2018-09-24 20:02:50 +08:00
|
|
|
|
|
|
|
attributes #0 = { minsize nounwind optsize }
|