| 1 |
; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 %s -o - | FileCheck %s |
| 2 |
; Check generated signed and unsigned multiply accumulate long. |
| 3 |
|
| 4 |
define i64 @MACLongTest1(i32 %a, i32 %b, i64 %c) { |
| 5 |
;CHECK-LABEL: MACLongTest1: |
| 6 |
;CHECK: umlal |
| 7 |
%conv = zext i32 %a to i64 |
| 8 |
%conv1 = zext i32 %b to i64 |
| 9 |
%mul = mul i64 %conv1, %conv |
| 10 |
%add = add i64 %mul, %c |
| 11 |
ret i64 %add |
| 12 |
} |
| 13 |
|
| 14 |
define i64 @MACLongTest2(i32 %a, i32 %b, i64 %c) { |
| 15 |
;CHECK-LABEL: MACLongTest2: |
| 16 |
;CHECK: smlal |
| 17 |
%conv = sext i32 %a to i64 |
| 18 |
%conv1 = sext i32 %b to i64 |
| 19 |
%mul = mul nsw i64 %conv1, %conv |
| 20 |
%add = add nsw i64 %mul, %c |
| 21 |
ret i64 %add |
| 22 |
} |
| 23 |
|
| 24 |
define i64 @MACLongTest3(i32 %a, i32 %b, i32 %c) { |
| 25 |
;CHECK-LABEL: MACLongTest3: |
| 26 |
;CHECK: umlal |
| 27 |
%conv = zext i32 %b to i64 |
| 28 |
%conv1 = zext i32 %a to i64 |
| 29 |
%mul = mul i64 %conv, %conv1 |
| 30 |
%conv2 = zext i32 %c to i64 |
| 31 |
%add = add i64 %mul, %conv2 |
| 32 |
ret i64 %add |
| 33 |
} |
| 34 |
|
| 35 |
define i64 @MACLongTest4(i32 %a, i32 %b, i32 %c) { |
| 36 |
;CHECK-LABEL: MACLongTest4: |
| 37 |
;CHECK: smlal |
| 38 |
%conv = sext i32 %b to i64 |
| 39 |
%conv1 = sext i32 %a to i64 |
| 40 |
%mul = mul nsw i64 %conv, %conv1 |
| 41 |
%conv2 = sext i32 %c to i64 |
| 42 |
%add = add nsw i64 %mul, %conv2 |
| 43 |
ret i64 %add |
| 44 |
} |