2017-05-17 20:48:08 +08:00
|
|
|
# RUN: llc -mtriple=x86_64-linux-gnu -global-isel -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X64
|
|
|
|
# RUN: llc -mtriple=i386-linux-gnu -global-isel -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X32
|
2017-02-10 15:05:56 +08:00
|
|
|
--- |
|
2017-03-03 16:06:46 +08:00
|
|
|
|
2017-09-17 19:34:17 +08:00
|
|
|
define void @test_add_i1() { ret void}
|
|
|
|
define void @test_add_i32() { ret void }
|
|
|
|
define void @test_add_i64() { ret void }
|
2017-02-10 15:05:56 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
---
|
2017-09-17 19:34:17 +08:00
|
|
|
name: test_add_i1
|
|
|
|
# CHECK-LABEL: name: test_add_i1
|
|
|
|
alignment: 4
|
|
|
|
legalized: false
|
|
|
|
regBankSelected: false
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: _, preferred-register: '' }
|
|
|
|
- { id: 1, class: _, preferred-register: '' }
|
|
|
|
- { id: 2, class: _, preferred-register: '' }
|
|
|
|
# CHECK: %0(s32) = COPY %edx
|
|
|
|
# CHECK-NEXT: %3(s8) = G_TRUNC %0(s32)
|
|
|
|
# CHECK-NEXT: %4(s8) = G_TRUNC %0(s32)
|
|
|
|
# CHECK-NEXT: %5(s8) = G_ADD %3, %4
|
|
|
|
# CHECK-NEXT: %2(s1) = G_TRUNC %5(s8)
|
|
|
|
# CHECK-NEXT: RET 0
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
|
|
|
|
|
|
|
%0(s32) = COPY %edx
|
|
|
|
%1(s1) = G_TRUNC %0(s32)
|
|
|
|
%2(s1) = G_ADD %1, %1
|
|
|
|
RET 0
|
|
|
|
...
|
|
|
|
---
|
2017-02-10 15:05:56 +08:00
|
|
|
name: test_add_i32
|
2017-05-17 20:48:08 +08:00
|
|
|
# ALL-LABEL: name: test_add_i32
|
2017-02-10 15:05:56 +08:00
|
|
|
alignment: 4
|
|
|
|
legalized: false
|
|
|
|
regBankSelected: false
|
2017-03-03 16:06:46 +08:00
|
|
|
registers:
|
2017-02-10 15:05:56 +08:00
|
|
|
- { id: 0, class: _ }
|
|
|
|
- { id: 1, class: _ }
|
|
|
|
- { id: 2, class: _ }
|
2017-10-25 02:04:54 +08:00
|
|
|
# ALL: %0:_(s32) = IMPLICIT_DEF
|
|
|
|
# ALL-NEXT: %1:_(s32) = IMPLICIT_DEF
|
|
|
|
# ALL-NEXT: %2:_(s32) = G_ADD %0, %1
|
2017-05-17 20:48:08 +08:00
|
|
|
# ALL-NEXT: RET 0
|
2017-02-10 15:05:56 +08:00
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
2017-05-17 20:48:08 +08:00
|
|
|
%0(s32) = IMPLICIT_DEF
|
|
|
|
%1(s32) = IMPLICIT_DEF
|
2017-02-10 15:05:56 +08:00
|
|
|
%2(s32) = G_ADD %0, %1
|
2017-05-17 20:48:08 +08:00
|
|
|
RET 0
|
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: test_add_i64
|
|
|
|
# ALL-LABEL: name: test_add_i64
|
|
|
|
alignment: 4
|
|
|
|
legalized: false
|
|
|
|
regBankSelected: false
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: _ }
|
|
|
|
- { id: 1, class: _ }
|
|
|
|
- { id: 2, class: _ }
|
2017-10-25 02:04:54 +08:00
|
|
|
# X64: %0:_(s64) = IMPLICIT_DEF
|
|
|
|
# X64-NEXT: %1:_(s64) = IMPLICIT_DEF
|
|
|
|
# X64-NEXT: %2:_(s64) = G_ADD %0, %1
|
2017-05-17 20:48:08 +08:00
|
|
|
# X64-NEXT: RET 0
|
|
|
|
#
|
2017-10-25 02:04:54 +08:00
|
|
|
# X32: %0:_(s64) = IMPLICIT_DEF
|
|
|
|
# X32-NEXT: %1:_(s64) = IMPLICIT_DEF
|
|
|
|
# X32-NEXT: %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %0(s64)
|
|
|
|
# X32-NEXT: %5:_(s32), %6:_(s32) = G_UNMERGE_VALUES %1(s64)
|
|
|
|
# X32-NEXT: %12:_(s8) = G_CONSTANT i8 0
|
|
|
|
# X32-NEXT: %7:_(s1) = G_TRUNC %12(s8)
|
|
|
|
# X32-NEXT: %8:_(s32), %9:_(s1) = G_UADDE %3, %5, %7
|
|
|
|
# X32-NEXT: %10:_(s32), %11:_(s1) = G_UADDE %4, %6, %9
|
|
|
|
# X32-NEXT: %2:_(s64) = G_MERGE_VALUES %8(s32), %10(s32)
|
2017-05-17 20:48:08 +08:00
|
|
|
# X32-NEXT: RET 0
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
|
|
|
%0(s64) = IMPLICIT_DEF
|
|
|
|
%1(s64) = IMPLICIT_DEF
|
|
|
|
%2(s64) = G_ADD %0, %1
|
|
|
|
RET 0
|
2017-02-10 15:05:56 +08:00
|
|
|
|
|
|
|
...
|