• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -O0 -mtriple=aarch64-apple-ios -global-isel -stop-after=irtranslator %s -o - | FileCheck %s
2
3; Test that extends correctly translate to G_[ZS]EXT. The translator will never
4; emit a G_SEXT_INREG.
5
6define i32 @test_zext(i32 %a) {
7  ; CHECK-LABEL: name: test_zext
8  ; CHECK: %0:_(s32) = COPY $w0
9  ; CHECK: %1:_(s8) = G_TRUNC %0(s32)
10  ; CHECK: %2:_(s16) = G_ZEXT %1(s8)
11  ; CHECK: %3:_(s32) = G_ZEXT %2(s16)
12  ; CHECK: $w0 = COPY %3(s32)
13  %tmp0 = trunc i32 %a to i8
14  %tmp1 = zext i8 %tmp0 to i16
15  %tmp2 = zext i16 %tmp1 to i32
16  ret i32 %tmp2
17}
18
19define i32 @test_sext(i32 %a) {
20  ; CHECK-LABEL: name: test_sext
21  ; CHECK: %0:_(s32) = COPY $w0
22  ; CHECK: %1:_(s8) = G_TRUNC %0(s32)
23  ; CHECK: %2:_(s16) = G_SEXT %1(s8)
24  ; CHECK: %3:_(s32) = G_SEXT %2(s16)
25  ; CHECK: $w0 = COPY %3(s32)
26  %tmp0 = trunc i32 %a to i8
27  %tmp1 = sext i8 %tmp0 to i16
28  %tmp2 = sext i16 %tmp1 to i32
29  ret i32 %tmp2
30}
31