2017-03-07 17:38:16 +08:00
|
|
|
; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V4
|
|
|
|
; RUN: llc -mtriple=armv6-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V6
|
|
|
|
; RUN: llc -mtriple=armv7-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V6
|
|
|
|
; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-THUMB
|
2018-05-30 02:17:16 +08:00
|
|
|
; RUN: llc -mtriple=thumbv6-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-THUMB
|
2017-03-07 17:38:16 +08:00
|
|
|
; RUN: llc -mtriple=thumbv6t2-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-THUMBV6T2
|
|
|
|
; RUN: llc -mtriple=thumbv7-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-THUMBV6T2
|
2018-01-12 17:21:09 +08:00
|
|
|
; RUN: llc -mtriple=thumbv7m-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V4
|
2018-11-23 18:08:39 +08:00
|
|
|
; RUN: llc -mtriple=thumbv7em-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-THUMBV6T2
|
2014-04-04 01:35:22 +08:00
|
|
|
|
2016-07-25 17:20:20 +08:00
|
|
|
define i32 @Test0(i32 %a, i32 %b, i32 %c) nounwind readnone ssp {
|
2012-05-17 21:12:13 +08:00
|
|
|
entry:
|
2016-07-25 17:20:20 +08:00
|
|
|
; CHECK-LABEL: Test0
|
2012-05-17 21:12:13 +08:00
|
|
|
; CHECK-NOT: smmls
|
|
|
|
%conv4 = zext i32 %a to i64
|
|
|
|
%conv1 = sext i32 %b to i64
|
|
|
|
%conv2 = sext i32 %c to i64
|
|
|
|
%mul = mul nsw i64 %conv2, %conv1
|
|
|
|
%shr5 = lshr i64 %mul, 32
|
|
|
|
%sub = sub nsw i64 %conv4, %shr5
|
|
|
|
%conv3 = trunc i64 %sub to i32
|
|
|
|
ret i32 %conv3
|
|
|
|
}
|
2016-07-25 17:20:20 +08:00
|
|
|
|
|
|
|
define i32 @Test1(i32 %a, i32 %b, i32 %c) {
|
|
|
|
;CHECK-LABEL: Test1
|
2017-03-07 17:38:16 +08:00
|
|
|
;CHECK-V4-NOT: smmls
|
2016-07-25 17:20:20 +08:00
|
|
|
;CHECK-THUMB-NOT: smmls
|
|
|
|
;CHECK-V6: smmls r0, [[Rn:r[1-2]]], [[Rm:r[1-2]]], r0
|
|
|
|
;CHECK-THUMBV6T2: smmls r0, [[Rn:r[1-2]]], [[Rm:r[1-2]]], r0
|
|
|
|
entry:
|
|
|
|
%conv = sext i32 %b to i64
|
|
|
|
%conv1 = sext i32 %c to i64
|
|
|
|
%mul = mul nsw i64 %conv1, %conv
|
|
|
|
%conv26 = zext i32 %a to i64
|
|
|
|
%shl = shl nuw i64 %conv26, 32
|
|
|
|
%sub = sub nsw i64 %shl, %mul
|
|
|
|
%shr7 = lshr i64 %sub, 32
|
|
|
|
%conv3 = trunc i64 %shr7 to i32
|
|
|
|
ret i32 %conv3
|
|
|
|
}
|
2016-08-03 07:12:36 +08:00
|
|
|
|
|
|
|
declare void @opaque(i32)
|
|
|
|
define void @test_used_flags(i32 %in1, i32 %in2) {
|
2017-03-07 17:38:16 +08:00
|
|
|
; CHECK-LABEL: test_used_flags:
|
2018-05-30 02:17:16 +08:00
|
|
|
; CHECK-THUMB: movs r2, #0
|
2018-11-01 05:45:48 +08:00
|
|
|
; CHECK-THUMB: rsbs r0, r0, #0
|
2018-05-30 02:17:16 +08:00
|
|
|
; CHECK-THUMB: sbcs r2, r1
|
|
|
|
; CHECK-THUMB: bge
|
2017-03-07 17:38:16 +08:00
|
|
|
; CHECK-V6: smull [[PROD_LO:r[0-9]+]], [[PROD_HI:r[0-9]+]], r0, r1
|
|
|
|
; CHECK-V6: rsbs {{.*}}, [[PROD_LO]], #0
|
|
|
|
; CHECK-V6: rscs {{.*}}, [[PROD_HI]], #0
|
|
|
|
; CHECK-THUMBV6T2: smull [[PROD_LO:r[0-9]+]], [[PROD_HI:r[0-9]+]], r0, r1
|
|
|
|
; CHECK-THUMBV6T2: movs [[ZERO:r[0-9]+]], #0
|
|
|
|
; CHECK-THUMBV6T2: rsbs {{.*}}, [[PROD_LO]], #0
|
|
|
|
; CHECK-THUMBV6T2: sbcs.w {{.*}}, [[ZERO]], [[PROD_HI]]
|
2016-08-03 07:12:36 +08:00
|
|
|
%in1.64 = sext i32 %in1 to i64
|
|
|
|
%in2.64 = sext i32 %in2 to i64
|
|
|
|
%mul = mul nsw i64 %in1.64, %in2.64
|
|
|
|
%tst = icmp slt i64 %mul, 1
|
|
|
|
br i1 %tst, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
call void @opaque(i32 42)
|
|
|
|
ret void
|
|
|
|
|
|
|
|
false:
|
|
|
|
call void @opaque(i32 56)
|
|
|
|
ret void
|
|
|
|
}
|