xref: /llvm-project/llvm/test/CodeGen/X86/GlobalISel/undef.ll (revision 19bc850220971aa8139a2ec3f848be0664033561)
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=ALL
3
4define i8 @test() {
5; ALL-LABEL: test:
6; ALL:       # %bb.0:
7; ALL-NEXT:    retq
8  ret i8 undef
9}
10
11define i8 @add_undef_i8(i8 %a) {
12; ALL-LABEL: add_undef_i8:
13; ALL:       # %bb.0:
14; ALL-NEXT:    movl %edi, %eax
15; ALL-NEXT:    addb %al, %al
16; ALL-NEXT:    # kill: def $al killed $al killed $eax
17; ALL-NEXT:    retq
18  %r = add i8 %a, undef
19  ret i8 %r
20}
21
22define i16 @add_undef_i16(i16 %a) {
23; ALL-LABEL: add_undef_i16:
24; ALL:       # %bb.0:
25; ALL-NEXT:    movl %edi, %eax
26; ALL-NEXT:    addw %ax, %ax
27; ALL-NEXT:    # kill: def $ax killed $ax killed $eax
28; ALL-NEXT:    retq
29  %r = add i16 %a, undef
30  ret i16 %r
31}
32
33define i16 @add_undef_i16_commute(i16 %a) {
34; ALL-LABEL: add_undef_i16_commute:
35; ALL:       # %bb.0:
36; ALL-NEXT:    addw %di, %ax
37; ALL-NEXT:    retq
38  %r = add i16 undef, %a
39  ret i16 %r
40}
41
42define i32 @add_undef_i32(i32 %a) {
43; ALL-LABEL: add_undef_i32:
44; ALL:       # %bb.0:
45; ALL-NEXT:    movl %edi, %eax
46; ALL-NEXT:    addl %eax, %eax
47; ALL-NEXT:    retq
48  %r = add i32 %a, undef
49  ret i32 %r
50}
51
52define float @test3() {
53; ALL-LABEL: test3:
54; ALL:       # %bb.0:
55; ALL-NEXT:    retq
56  ret float undef
57}
58
59define float @test4(float %a) {
60; ALL-LABEL: test4:
61; ALL:       # %bb.0:
62; ALL-NEXT:    addss %xmm0, %xmm0
63; ALL-NEXT:    retq
64  %r = fadd float %a, undef
65  ret float %r
66}
67
68