• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-linux-gnu    -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64
3
4; TODO merge with ext.ll after i64 sext supported on 32bit platform
5
6define i64 @test_zext_i1(i8 %a) {
7; X64-LABEL: test_zext_i1:
8; X64:       # %bb.0:
9; X64-NEXT:    # kill: def $edi killed $edi def $rdi
10; X64-NEXT:    andq $1, %rdi
11; X64-NEXT:    movq %rdi, %rax
12; X64-NEXT:    retq
13  %val = trunc i8 %a to i1
14  %r = zext i1 %val to i64
15  ret i64 %r
16}
17
18define i64 @test_sext_i8(i8 %val) {
19; X64-LABEL: test_sext_i8:
20; X64:       # %bb.0:
21; X64-NEXT:    # kill: def $edi killed $edi def $rdi
22; X64-NEXT:    movq $56, %rcx
23; X64-NEXT:    # kill: def $cl killed $rcx
24; X64-NEXT:    shlq %cl, %rdi
25; X64-NEXT:    movq $56, %rcx
26; X64-NEXT:    # kill: def $cl killed $rcx
27; X64-NEXT:    sarq %cl, %rdi
28; X64-NEXT:    movq %rdi, %rax
29; X64-NEXT:    retq
30  %r = sext i8 %val to i64
31  ret i64 %r
32}
33
34define i64 @test_sext_i16(i16 %val) {
35; X64-LABEL: test_sext_i16:
36; X64:       # %bb.0:
37; X64-NEXT:    # kill: def $edi killed $edi def $rdi
38; X64-NEXT:    movq $48, %rcx
39; X64-NEXT:    # kill: def $cl killed $rcx
40; X64-NEXT:    shlq %cl, %rdi
41; X64-NEXT:    movq $48, %rcx
42; X64-NEXT:    # kill: def $cl killed $rcx
43; X64-NEXT:    sarq %cl, %rdi
44; X64-NEXT:    movq %rdi, %rax
45; X64-NEXT:    retq
46  %r = sext i16 %val to i64
47  ret i64 %r
48}
49
50; TODO enable after selection supported
51;define i64 @test_sext_i32(i32 %val) {
52;  %r = sext i32 %val to i64
53;  ret i64 %r
54;}
55
56