1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[ARM] Automatically generate dsp-mlal.ll . NFC

llvm-svn: 369718
This commit is contained in:
Amaury Sechet 2019-08-22 23:43:48 +00:00
parent e17deae810
commit be2c83c616

View File

@ -1,16 +1,34 @@
; RUN: llc -mtriple=thumbv7m -mattr=+dsp %s -o - | FileCheck %s ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=armv7a %s -o - | FileCheck %s ; RUN: llc -mtriple=thumbv7m -mattr=+dsp %s -o - | FileCheck %s --check-prefix=DSP
; RUN: llc -mtriple=thumbv7m -mattr=-dsp %s -o - | FileCheck --check-prefix=NODSP %s ; RUN: llc -mtriple=armv7a %s -o - | FileCheck %s --check-prefix=ARM7
; RUN: llc -mtriple=thumbv7m -mattr=-dsp %s -o - | FileCheck %s --check-prefix=NODSP
define hidden i32 @SMMULR_SMMLAR(i32 %a, i32 %b0, i32 %b1, i32 %Xn, i32 %Xn1) local_unnamed_addr { define hidden i32 @SMMULR_SMMLAR(i32 %a, i32 %b0, i32 %b1, i32 %Xn, i32 %Xn1) local_unnamed_addr {
entry: ; DSP-LABEL: SMMULR_SMMLAR:
; CHECK-LABEL: SMMULR_SMMLAR: ; DSP: @ %bb.0: @ %entry
; CHECK: ldr r0, [sp] ; DSP-NEXT: ldr r0, [sp]
; CHECK-NEXT: smmulr r0, {{(r0, r2|r2, r0)}} ; DSP-NEXT: smmulr r0, r0, r2
; CHECK-NEXT: smmlar r0, {{(r1, r3|r3, r1)}}, r0 ; DSP-NEXT: smmlar r0, r3, r1, r0
; DSP-NEXT: bx lr
;
; ARM7-LABEL: SMMULR_SMMLAR:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: ldr r0, [sp]
; ARM7-NEXT: smmulr r0, r0, r2
; ARM7-NEXT: smmlar r0, r3, r1, r0
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: SMMULR_SMMLAR: ; NODSP-LABEL: SMMULR_SMMLAR:
; NODSP-NOT: smmulr ; NODSP: @ %bb.0: @ %entry
; NODSP-NOT: smmlar ; NODSP-NEXT: push {r4, lr}
; NODSP-NEXT: ldr.w lr, [sp, #8]
; NODSP-NEXT: movs r0, #0
; NODSP-NEXT: mov.w r4, #-2147483648
; NODSP-NEXT: mov.w r12, #-2147483648
; NODSP-NEXT: smlal r4, r0, lr, r2
; NODSP-NEXT: smlal r12, r0, r3, r1
; NODSP-NEXT: pop {r4, pc}
entry:
%conv = sext i32 %b1 to i64 %conv = sext i32 %b1 to i64
%conv1 = sext i32 %Xn1 to i64 %conv1 = sext i32 %Xn1 to i64
%mul = mul nsw i64 %conv1, %conv %mul = mul nsw i64 %conv1, %conv
@ -27,11 +45,24 @@ entry:
} }
define hidden i32 @SMMULR(i32 %a, i32 %b) local_unnamed_addr { define hidden i32 @SMMULR(i32 %a, i32 %b) local_unnamed_addr {
entry: ; DSP-LABEL: SMMULR:
; CHECK-LABEL: SMMULR: ; DSP: @ %bb.0: @ %entry
; CHECK: smmulr r0, {{(r0, r1|r1, r0)}} ; DSP-NEXT: smmulr r0, r1, r0
; DSP-NEXT: bx lr
;
; ARM7-LABEL: SMMULR:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: smmulr r0, r1, r0
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: SMMULR: ; NODSP-LABEL: SMMULR:
; NODSP-NOT: smmulr ; NODSP: @ %bb.0: @ %entry
; NODSP-NEXT: movs r2, #0
; NODSP-NEXT: mov.w r3, #-2147483648
; NODSP-NEXT: smlal r3, r2, r1, r0
; NODSP-NEXT: mov r0, r2
; NODSP-NEXT: bx lr
entry:
%conv = sext i32 %a to i64 %conv = sext i32 %a to i64
%conv1 = sext i32 %b to i64 %conv1 = sext i32 %b to i64
%mul = mul nsw i64 %conv1, %conv %mul = mul nsw i64 %conv1, %conv
@ -42,11 +73,21 @@ entry:
} }
define hidden i32 @SMMUL(i32 %a, i32 %b) local_unnamed_addr { define hidden i32 @SMMUL(i32 %a, i32 %b) local_unnamed_addr {
entry: ; DSP-LABEL: SMMUL:
; CHECK-LABEL: SMMUL: ; DSP: @ %bb.0: @ %entry
; CHECK: smmul r0, {{(r0, r1|r1, r0)}} ; DSP-NEXT: smmul r0, r1, r0
; DSP-NEXT: bx lr
;
; ARM7-LABEL: SMMUL:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: smmul r0, r1, r0
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: SMMUL: ; NODSP-LABEL: SMMUL:
; NODSP-NOT: smmul ; NODSP: @ %bb.0: @ %entry
; NODSP-NEXT: smull r1, r0, r1, r0
; NODSP-NEXT: bx lr
entry:
%conv = sext i32 %a to i64 %conv = sext i32 %a to i64
%conv1 = sext i32 %b to i64 %conv1 = sext i32 %b to i64
%mul = mul nsw i64 %conv1, %conv %mul = mul nsw i64 %conv1, %conv
@ -56,11 +97,23 @@ entry:
} }
define hidden i32 @SMMLSR(i32 %a, i32 %b, i32 %c) local_unnamed_addr { define hidden i32 @SMMLSR(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry: ; DSP-LABEL: SMMLSR:
; CHECK-LABEL: SMMLSR: ; DSP: @ %bb.0: @ %entry
; CHECK: smmlsr r0, {{(r1, r2|r2, r1)}}, r0 ; DSP-NEXT: smmlsr r0, r2, r1, r0
; DSP-NEXT: bx lr
;
; ARM7-LABEL: SMMLSR:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: smmlsr r0, r2, r1, r0
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: SMMLSR: ; NODSP-LABEL: SMMLSR:
; NODSP-NOT: smmlsr ; NODSP: @ %bb.0: @ %entry
; NODSP-NEXT: smull r1, r2, r2, r1
; NODSP-NEXT: rsbs.w r1, r1, #-2147483648
; NODSP-NEXT: sbcs r0, r2
; NODSP-NEXT: bx lr
entry:
%conv6 = zext i32 %a to i64 %conv6 = zext i32 %a to i64
%shl = shl nuw i64 %conv6, 32 %shl = shl nuw i64 %conv6, 32
%conv1 = sext i32 %b to i64 %conv1 = sext i32 %b to i64
@ -74,11 +127,26 @@ entry:
} }
define hidden i32 @NOT_SMMLSR(i32 %a, i32 %b, i32 %c) local_unnamed_addr { define hidden i32 @NOT_SMMLSR(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry: ; DSP-LABEL: NOT_SMMLSR:
; CHECK-LABEL: NOT_SMMLSR: ; DSP: @ %bb.0: @ %entry
; CHECK-NOT: smmlsr ; DSP-NEXT: smmulr r1, r2, r1
; DSP-NEXT: subs r0, r0, r1
; DSP-NEXT: bx lr
;
; ARM7-LABEL: NOT_SMMLSR:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: smmulr r1, r2, r1
; ARM7-NEXT: sub r0, r0, r1
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: NOT_SMMLSR: ; NODSP-LABEL: NOT_SMMLSR:
; NODSP-NOT: smmlsr ; NODSP: @ %bb.0: @ %entry
; NODSP-NEXT: mov.w r12, #0
; NODSP-NEXT: mov.w r3, #-2147483648
; NODSP-NEXT: smlal r3, r12, r2, r1
; NODSP-NEXT: sub.w r0, r0, r12
; NODSP-NEXT: bx lr
entry:
%conv = sext i32 %b to i64 %conv = sext i32 %b to i64
%conv1 = sext i32 %c to i64 %conv1 = sext i32 %c to i64
%mul = mul nsw i64 %conv1, %conv %mul = mul nsw i64 %conv1, %conv
@ -90,11 +158,23 @@ entry:
} }
define hidden i32 @SMMLS(i32 %a, i32 %b, i32 %c) local_unnamed_addr { define hidden i32 @SMMLS(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry: ; DSP-LABEL: SMMLS:
; CHECK-LABEL: SMMLS: ; DSP: @ %bb.0: @ %entry
; CHECK: smmls r0, {{(r1, r2|r2, r1)}}, r0 ; DSP-NEXT: smmls r0, r2, r1, r0
; DSP-NEXT: bx lr
;
; ARM7-LABEL: SMMLS:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: smmls r0, r2, r1, r0
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: SMMLS: ; NODSP-LABEL: SMMLS:
; NODSP-NOT: smmls ; NODSP: @ %bb.0: @ %entry
; NODSP-NEXT: smull r1, r2, r2, r1
; NODSP-NEXT: rsbs r1, r1, #0
; NODSP-NEXT: sbcs r0, r2
; NODSP-NEXT: bx lr
entry:
%conv5 = zext i32 %a to i64 %conv5 = zext i32 %a to i64
%shl = shl nuw i64 %conv5, 32 %shl = shl nuw i64 %conv5, 32
%conv1 = sext i32 %b to i64 %conv1 = sext i32 %b to i64
@ -107,11 +187,24 @@ entry:
} }
define hidden i32 @NOT_SMMLS(i32 %a, i32 %b, i32 %c) local_unnamed_addr { define hidden i32 @NOT_SMMLS(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry: ; DSP-LABEL: NOT_SMMLS:
; CHECK-LABEL: NOT_SMMLS: ; DSP: @ %bb.0: @ %entry
; CHECK-NOT: smmls ; DSP-NEXT: smmul r1, r2, r1
; DSP-NEXT: subs r0, r0, r1
; DSP-NEXT: bx lr
;
; ARM7-LABEL: NOT_SMMLS:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: smmul r1, r2, r1
; ARM7-NEXT: sub r0, r0, r1
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: NOT_SMMLS: ; NODSP-LABEL: NOT_SMMLS:
; NODSP-NOT: smmls ; NODSP: @ %bb.0: @ %entry
; NODSP-NEXT: smull r1, r2, r2, r1
; NODSP-NEXT: subs r0, r0, r2
; NODSP-NEXT: bx lr
entry:
%conv = sext i32 %b to i64 %conv = sext i32 %b to i64
%conv1 = sext i32 %c to i64 %conv1 = sext i32 %c to i64
%mul = mul nsw i64 %conv1, %conv %mul = mul nsw i64 %conv1, %conv
@ -122,11 +215,22 @@ entry:
} }
define hidden i32 @SMMLA(i32 %a, i32 %b, i32 %c) local_unnamed_addr { define hidden i32 @SMMLA(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry: ; DSP-LABEL: SMMLA:
; CHECK-LABEL: SMMLA: ; DSP: @ %bb.0: @ %entry
; CHECK: smmla r0, {{(r1, r2|r2, r1)}}, r0 ; DSP-NEXT: smmla r0, r1, r2, r0
; DSP-NEXT: bx lr
;
; ARM7-LABEL: SMMLA:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: smmla r0, r2, r1, r0
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: SMMLA: ; NODSP-LABEL: SMMLA:
; NODSP-NOT: smmla ; NODSP: @ %bb.0: @ %entry
; NODSP-NEXT: smull r1, r2, r2, r1
; NODSP-NEXT: add r0, r2
; NODSP-NEXT: bx lr
entry:
%conv = sext i32 %b to i64 %conv = sext i32 %b to i64
%conv1 = sext i32 %c to i64 %conv1 = sext i32 %c to i64
%mul = mul nsw i64 %conv1, %conv %mul = mul nsw i64 %conv1, %conv
@ -137,11 +241,22 @@ entry:
} }
define hidden i32 @SMMLAR(i32 %a, i32 %b, i32 %c) local_unnamed_addr { define hidden i32 @SMMLAR(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry: ; DSP-LABEL: SMMLAR:
; CHECK-LABEL: SMMLAR: ; DSP: @ %bb.0: @ %entry
; CHECK: smmlar r0, {{(r1, r2|r2, r1)}}, r0 ; DSP-NEXT: smmlar r0, r2, r1, r0
; DSP-NEXT: bx lr
;
; ARM7-LABEL: SMMLAR:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: smmlar r0, r2, r1, r0
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: SMMLAR: ; NODSP-LABEL: SMMLAR:
; NODSP-NOT: smmlar ; NODSP: @ %bb.0: @ %entry
; NODSP-NEXT: mov.w r3, #-2147483648
; NODSP-NEXT: smlal r3, r0, r2, r1
; NODSP-NEXT: bx lr
entry:
%conv7 = zext i32 %a to i64 %conv7 = zext i32 %a to i64
%shl = shl nuw i64 %conv7, 32 %shl = shl nuw i64 %conv7, 32
%conv1 = sext i32 %b to i64 %conv1 = sext i32 %b to i64
@ -155,11 +270,27 @@ entry:
} }
define hidden i32 @NOT_SMMLA(i32 %a, i32 %b, i32 %c) local_unnamed_addr { define hidden i32 @NOT_SMMLA(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry: ; DSP-LABEL: NOT_SMMLA:
; CHECK-LABEL: NOT_SMMLA: ; DSP: @ %bb.0: @ %entry
; CHECK-NOT: smmla ; DSP-NEXT: smmul r1, r2, r1
; DSP-NEXT: eor r1, r1, #-2147483648
; DSP-NEXT: add r0, r1
; DSP-NEXT: bx lr
;
; ARM7-LABEL: NOT_SMMLA:
; ARM7: @ %bb.0: @ %entry
; ARM7-NEXT: smmul r1, r2, r1
; ARM7-NEXT: eor r1, r1, #-2147483648
; ARM7-NEXT: add r0, r1, r0
; ARM7-NEXT: bx lr
;
; NODSP-LABEL: NOT_SMMLA: ; NODSP-LABEL: NOT_SMMLA:
; NODSP-NOT: smmla ; NODSP: @ %bb.0: @ %entry
; NODSP-NEXT: smull r1, r2, r2, r1
; NODSP-NEXT: eor r1, r2, #-2147483648
; NODSP-NEXT: add r0, r1
; NODSP-NEXT: bx lr
entry:
%conv = sext i32 %b to i64 %conv = sext i32 %b to i64
%conv1 = sext i32 %c to i64 %conv1 = sext i32 %c to i64
%mul = mul nsw i64 %conv1, %conv %mul = mul nsw i64 %conv1, %conv