[ARM64-BE] Make big endian (scalar) argument passing work correctly.
[oota-llvm.git] / test / CodeGen / AArch64 / adc.ll
1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck --check-prefix=CHECK --check-prefix=CHECK-LE %s
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64_be-none-linux-gnu | FileCheck --check-prefix=CHECK --check-prefix=CHECK-BE %s
3 ; RUN: llc -verify-machineinstrs < %s -mtriple=arm64-apple-ios7.0 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-LE %s
4 ; RUN: llc -verify-machineinstrs < %s -mtriple=arm64_be-none-linux-gnu | FileCheck --check-prefix=CHECK --check-prefix=CHECK-BE %s
5
6 define i128 @test_simple(i128 %a, i128 %b, i128 %c) {
7 ; CHECK-LABEL: test_simple:
8
9   %valadd = add i128 %a, %b
10 ; CHECK-LE: adds [[ADDLO:x[0-9]+]], x0, x2
11 ; CHECK-LE-NEXT: adcs [[ADDHI:x[0-9]+]], x1, x3
12 ; CHECK-BE: adds [[ADDLO:x[0-9]+]], x1, x3
13 ; CHECK-BE-NEXT: adcs [[ADDHI:x[0-9]+]], x0, x2
14
15   %valsub = sub i128 %valadd, %c
16 ; CHECK-LE: subs x0, [[ADDLO]], x4
17 ; CHECK-LE: sbcs x1, [[ADDHI]], x5
18 ; CHECK-BE: subs x1, [[ADDLO]], x5
19 ; CHECK-BE: sbcs x0, [[ADDHI]], x4
20
21   ret i128 %valsub
22 ; CHECK: ret
23 }
24
25 define i128 @test_imm(i128 %a) {
26 ; CHECK-LABEL: test_imm:
27
28   %val = add i128 %a, 12
29 ; CHECK-LE: adds x0, x0, #12
30 ; CHECK-LE: adcs x1, x1, {{x[0-9]|xzr}}
31 ; CHECK-BE: adds x1, x1, #12
32 ; CHECK-BE: adcs x0, x0, {{x[0-9]|xzr}}
33
34   ret i128 %val
35 ; CHECK: ret
36 }
37
38 define i128 @test_shifted(i128 %a, i128 %b) {
39 ; CHECK-LABEL: test_shifted:
40
41   %rhs = shl i128 %b, 45
42
43   %val = add i128 %a, %rhs
44 ; CHECK-LE: adds x0, x0, x2, lsl #45
45 ; CHECK-LE: adcs x1, x1, {{x[0-9]}}
46 ; CHECK-BE: adds x1, x1, x3, lsl #45
47 ; CHECK-BE: adcs x0, x0, {{x[0-9]}}
48
49   ret i128 %val
50 ; CHECK: ret
51 }
52
53 define i128 @test_extended(i128 %a, i16 %b) {
54 ; CHECK-LABEL: test_extended:
55
56   %ext = sext i16 %b to i128
57   %rhs = shl i128 %ext, 3
58
59   %val = add i128 %a, %rhs
60 ; CHECK-LE: adds x0, x0, w2, sxth #3
61 ; CHECK-LE: adcs x1, x1, {{x[0-9]}}
62 ; CHECK-BE: adds x1, x1, w2, sxth #3
63 ; CHECK-BE: adcs x0, x0, {{x[0-9]}}
64
65   ret i128 %val
66 ; CHECK: ret
67 }