1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
; RUN: llc -mtriple=thumbv7m -mattr=+dsp %s -o - | FileCheck %s
; RUN: llc -mtriple=armv7a %s -o - | FileCheck %s
; RUN: llc -mtriple=thumbv7m -mattr=-dsp %s -o - | FileCheck --check-prefix=NODSP %s
define hidden i32 @SMMULR_SMMLAR(i32 %a, i32 %b0, i32 %b1, i32 %Xn, i32 %Xn1) local_unnamed_addr {
entry:
; CHECK-LABEL: SMMULR_SMMLAR:
; CHECK: ldr r0, [sp]
; CHECK-NEXT: smmulr r0, {{(r0, r2|r2, r0)}}
; CHECK-NEXT: smmlar r0, {{(r1, r3|r3, r1)}}, r0
; NODSP-LABEL: SMMULR_SMMLAR:
; NODSP-NOT: smmulr
; NODSP-NOT: smmlar
%conv = sext i32 %b1 to i64
%conv1 = sext i32 %Xn1 to i64
%mul = mul nsw i64 %conv1, %conv
%add = add nsw i64 %mul, 2147483648
%0 = and i64 %add, -4294967296
%conv4 = sext i32 %b0 to i64
%conv5 = sext i32 %Xn to i64
%mul6 = mul nsw i64 %conv5, %conv4
%add7 = add i64 %mul6, 2147483648
%add8 = add i64 %add7, %0
%1 = lshr i64 %add8, 32
%conv10 = trunc i64 %1 to i32
ret i32 %conv10
}
define hidden i32 @SMMULR(i32 %a, i32 %b) local_unnamed_addr {
entry:
; CHECK-LABEL: SMMULR:
; CHECK: smmulr r0, {{(r0, r1|r1, r0)}}
; NODSP-LABEL: SMMULR:
; NODSP-NOT: smmulr
%conv = sext i32 %a to i64
%conv1 = sext i32 %b to i64
%mul = mul nsw i64 %conv1, %conv
%add = add nsw i64 %mul, 2147483648
%0 = lshr i64 %add, 32
%conv2 = trunc i64 %0 to i32
ret i32 %conv2
}
define hidden i32 @SMMUL(i32 %a, i32 %b) local_unnamed_addr {
entry:
; CHECK-LABEL: SMMUL:
; CHECK: smmul r0, {{(r0, r1|r1, r0)}}
; NODSP-LABEL: SMMUL:
; NODSP-NOT: smmul
%conv = sext i32 %a to i64
%conv1 = sext i32 %b to i64
%mul = mul nsw i64 %conv1, %conv
%0 = lshr i64 %mul, 32
%conv2 = trunc i64 %0 to i32
ret i32 %conv2
}
define hidden i32 @SMMLSR(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry:
; CHECK-LABEL: SMMLSR:
; CHECK: smmlsr r0, {{(r1, r2|r2, r1)}}, r0
; NODSP-LABEL: SMMLSR:
; NODSP-NOT: smmlsr
%conv6 = zext i32 %a to i64
%shl = shl nuw i64 %conv6, 32
%conv1 = sext i32 %b to i64
%conv2 = sext i32 %c to i64
%mul = mul nsw i64 %conv2, %conv1
%sub = or i64 %shl, 2147483648
%add = sub i64 %sub, %mul
%0 = lshr i64 %add, 32
%conv3 = trunc i64 %0 to i32
ret i32 %conv3
}
define hidden i32 @NOT_SMMLSR(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry:
; CHECK-LABEL: NOT_SMMLSR:
; CHECK-NOT: smmlsr
; NODSP-LABEL: NOT_SMMLSR:
; NODSP-NOT: smmlsr
%conv = sext i32 %b to i64
%conv1 = sext i32 %c to i64
%mul = mul nsw i64 %conv1, %conv
%add = add nsw i64 %mul, 2147483648
%0 = lshr i64 %add, 32
%conv2 = trunc i64 %0 to i32
%sub = sub nsw i32 %a, %conv2
ret i32 %sub
}
define hidden i32 @SMMLS(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry:
; CHECK-LABEL: SMMLS:
; CHECK: smmls r0, {{(r1, r2|r2, r1)}}, r0
; NODSP-LABEL: SMMLS:
; NODSP-NOT: smmls
%conv5 = zext i32 %a to i64
%shl = shl nuw i64 %conv5, 32
%conv1 = sext i32 %b to i64
%conv2 = sext i32 %c to i64
%mul = mul nsw i64 %conv2, %conv1
%sub = sub nsw i64 %shl, %mul
%0 = lshr i64 %sub, 32
%conv3 = trunc i64 %0 to i32
ret i32 %conv3
}
define hidden i32 @NOT_SMMLS(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry:
; CHECK-LABEL: NOT_SMMLS:
; CHECK-NOT: smmls
; NODSP-LABEL: NOT_SMMLS:
; NODSP-NOT: smmls
%conv = sext i32 %b to i64
%conv1 = sext i32 %c to i64
%mul = mul nsw i64 %conv1, %conv
%0 = lshr i64 %mul, 32
%conv2 = trunc i64 %0 to i32
%sub = sub nsw i32 %a, %conv2
ret i32 %sub
}
define hidden i32 @SMMLA(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry:
; CHECK-LABEL: SMMLA:
; CHECK: smmla r0, {{(r1, r2|r2, r1)}}, r0
; NODSP-LABEL: SMMLA:
; NODSP-NOT: smmla
%conv = sext i32 %b to i64
%conv1 = sext i32 %c to i64
%mul = mul nsw i64 %conv1, %conv
%0 = lshr i64 %mul, 32
%conv2 = trunc i64 %0 to i32
%add = add nsw i32 %conv2, %a
ret i32 %add
}
define hidden i32 @SMMLAR(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry:
; CHECK-LABEL: SMMLAR:
; CHECK: smmlar r0, {{(r1, r2|r2, r1)}}, r0
; NODSP-LABEL: SMMLAR:
; NODSP-NOT: smmlar
%conv7 = zext i32 %a to i64
%shl = shl nuw i64 %conv7, 32
%conv1 = sext i32 %b to i64
%conv2 = sext i32 %c to i64
%mul = mul nsw i64 %conv2, %conv1
%add = or i64 %shl, 2147483648
%add3 = add i64 %add, %mul
%0 = lshr i64 %add3, 32
%conv4 = trunc i64 %0 to i32
ret i32 %conv4
}
define hidden i32 @NOT_SMMLA(i32 %a, i32 %b, i32 %c) local_unnamed_addr {
entry:
; CHECK-LABEL: NOT_SMMLA:
; CHECK-NOT: smmla
; NODSP-LABEL: NOT_SMMLA:
; NODSP-NOT: smmla
%conv = sext i32 %b to i64
%conv1 = sext i32 %c to i64
%mul = mul nsw i64 %conv1, %conv
%0 = lshr i64 %mul, 32
%conv2 = trunc i64 %0 to i32
%add = xor i32 %conv2, -2147483648
%add3 = add i32 %add, %a
ret i32 %add3
}
|