2014-08-04 13:10:33 +08:00
|
|
|
; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
define i32 @test_madd32(i32 %val0, i32 %val1, i32 %val2) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_madd32:
|
2013-01-31 20:12:40 +08:00
|
|
|
%mid = mul i32 %val1, %val2
|
|
|
|
%res = add i32 %val0, %mid
|
|
|
|
; CHECK: madd {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_madd64(i64 %val0, i64 %val1, i64 %val2) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_madd64:
|
2013-01-31 20:12:40 +08:00
|
|
|
%mid = mul i64 %val1, %val2
|
|
|
|
%res = add i64 %val0, %mid
|
|
|
|
; CHECK: madd {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_msub32(i32 %val0, i32 %val1, i32 %val2) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_msub32:
|
2013-01-31 20:12:40 +08:00
|
|
|
%mid = mul i32 %val1, %val2
|
|
|
|
%res = sub i32 %val0, %mid
|
|
|
|
; CHECK: msub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_msub64(i64 %val0, i64 %val1, i64 %val2) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_msub64:
|
2013-01-31 20:12:40 +08:00
|
|
|
%mid = mul i64 %val1, %val2
|
|
|
|
%res = sub i64 %val0, %mid
|
|
|
|
; CHECK: msub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_smaddl(i64 %acc, i32 %val1, i32 %val2) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_smaddl:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = sext i32 %val1 to i64
|
|
|
|
%ext2 = sext i32 %val2 to i64
|
|
|
|
%prod = mul i64 %ext1, %ext2
|
|
|
|
%res = add i64 %acc, %prod
|
|
|
|
; CHECK: smaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_smsubl(i64 %acc, i32 %val1, i32 %val2) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_smsubl:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = sext i32 %val1 to i64
|
|
|
|
%ext2 = sext i32 %val2 to i64
|
|
|
|
%prod = mul i64 %ext1, %ext2
|
|
|
|
%res = sub i64 %acc, %prod
|
|
|
|
; CHECK: smsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_umaddl(i64 %acc, i32 %val1, i32 %val2) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_umaddl:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = zext i32 %val1 to i64
|
|
|
|
%ext2 = zext i32 %val2 to i64
|
|
|
|
%prod = mul i64 %ext1, %ext2
|
|
|
|
%res = add i64 %acc, %prod
|
|
|
|
; CHECK: umaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_umsubl(i64 %acc, i32 %val1, i32 %val2) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_umsubl:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = zext i32 %val1 to i64
|
|
|
|
%ext2 = zext i32 %val2 to i64
|
|
|
|
%prod = mul i64 %ext1, %ext2
|
|
|
|
%res = sub i64 %acc, %prod
|
|
|
|
; CHECK: umsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_smulh(i64 %lhs, i64 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_smulh:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = sext i64 %lhs to i128
|
|
|
|
%ext2 = sext i64 %rhs to i128
|
|
|
|
%res = mul i128 %ext1, %ext2
|
|
|
|
%high = lshr i128 %res, 64
|
|
|
|
%val = trunc i128 %high to i64
|
|
|
|
; CHECK: smulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %val
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_umulh(i64 %lhs, i64 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_umulh:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = zext i64 %lhs to i128
|
|
|
|
%ext2 = zext i64 %rhs to i128
|
|
|
|
%res = mul i128 %ext1, %ext2
|
|
|
|
%high = lshr i128 %res, 64
|
|
|
|
%val = trunc i128 %high to i64
|
|
|
|
; CHECK: umulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %val
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_mul32(i32 %lhs, i32 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_mul32:
|
2013-01-31 20:12:40 +08:00
|
|
|
%res = mul i32 %lhs, %rhs
|
|
|
|
; CHECK: mul {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_mul64(i64 %lhs, i64 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_mul64:
|
2013-01-31 20:12:40 +08:00
|
|
|
%res = mul i64 %lhs, %rhs
|
|
|
|
; CHECK: mul {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_mneg32(i32 %lhs, i32 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_mneg32:
|
2013-01-31 20:12:40 +08:00
|
|
|
%prod = mul i32 %lhs, %rhs
|
|
|
|
%res = sub i32 0, %prod
|
|
|
|
; CHECK: mneg {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_mneg64(i64 %lhs, i64 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_mneg64:
|
2013-01-31 20:12:40 +08:00
|
|
|
%prod = mul i64 %lhs, %rhs
|
|
|
|
%res = sub i64 0, %prod
|
|
|
|
; CHECK: mneg {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_smull(i32 %lhs, i32 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_smull:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = sext i32 %lhs to i64
|
|
|
|
%ext2 = sext i32 %rhs to i64
|
|
|
|
%res = mul i64 %ext1, %ext2
|
|
|
|
; CHECK: smull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_umull(i32 %lhs, i32 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_umull:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = zext i32 %lhs to i64
|
|
|
|
%ext2 = zext i32 %rhs to i64
|
|
|
|
%res = mul i64 %ext1, %ext2
|
|
|
|
; CHECK: umull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_smnegl(i32 %lhs, i32 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_smnegl:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = sext i32 %lhs to i64
|
|
|
|
%ext2 = sext i32 %rhs to i64
|
|
|
|
%prod = mul i64 %ext1, %ext2
|
|
|
|
%res = sub i64 0, %prod
|
|
|
|
; CHECK: smnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_umnegl(i32 %lhs, i32 %rhs) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_umnegl:
|
2013-01-31 20:12:40 +08:00
|
|
|
%ext1 = zext i32 %lhs to i64
|
|
|
|
%ext2 = zext i32 %rhs to i64
|
|
|
|
%prod = mul i64 %ext1, %ext2
|
|
|
|
%res = sub i64 0, %prod
|
|
|
|
; CHECK: umnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
2014-12-22 21:38:58 +08:00
|
|
|
|
|
|
|
@a = common global i32 0, align 4
|
|
|
|
@b = common global i32 0, align 4
|
|
|
|
@c = common global i32 0, align 4
|
|
|
|
|
|
|
|
define void @test_mneg(){
|
|
|
|
; CHECK-LABEL: test_mneg:
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load i32, i32* @a, align 4
|
|
|
|
%2 = load i32, i32* @b, align 4
|
2014-12-22 21:38:58 +08:00
|
|
|
%3 = sub i32 0, %1
|
|
|
|
%4 = mul i32 %2, %3
|
|
|
|
store i32 %4, i32* @c, align 4
|
|
|
|
; CHECK: mneg {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret void
|
|
|
|
}
|