1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s 2>&1 | FileCheck %s --check-prefix=X86ASM
4 %struct.T = type { i32, i32 }
6 define i32 @freeze_int() {
7 ; X86ASM-LABEL: freeze_int:
9 ; X86ASM-NEXT: imull %eax, %eax
11 %y1 = freeze i32 undef
12 %t1 = mul i32 %y1, %y1
16 define i5 @freeze_int2() {
17 ; X86ASM-LABEL: freeze_int2:
19 ; X86ASM-NEXT: mulb %al
26 define float @freeze_float() {
27 ; X86ASM-LABEL: freeze_float:
29 ; X86ASM-NEXT: addss %xmm0, %xmm0
31 %y1 = freeze float undef
32 %t1 = fadd float %y1, %y1
36 define half @freeze_half() {
37 ; X86ASM-LABEL: freeze_half:
39 ; X86ASM-NEXT: pushq %rax
40 ; X86ASM-NEXT: .cfi_def_cfa_offset 16
41 ; X86ASM-NEXT: callq __extendhfsf2@PLT
42 ; X86ASM-NEXT: addss %xmm0, %xmm0
43 ; X86ASM-NEXT: callq __truncsfhf2@PLT
44 ; X86ASM-NEXT: popq %rax
45 ; X86ASM-NEXT: .cfi_def_cfa_offset 8
47 %y1 = freeze half undef
48 %t1 = fadd half %y1, %y1
52 define <2 x i32> @freeze_ivec() {
53 ; X86ASM-LABEL: freeze_ivec:
55 ; X86ASM-NEXT: paddd %xmm0, %xmm0
57 %y1 = freeze <2 x i32> undef
58 %t1 = add <2 x i32> %y1, %y1
62 define ptr @freeze_ptr() {
63 ; X86ASM-LABEL: freeze_ptr:
65 ; X86ASM-NEXT: addq $4, %rax
67 %y1 = freeze ptr undef
68 %t1 = getelementptr i8, ptr %y1, i64 4
72 define i32 @freeze_struct() {
73 ; X86ASM-LABEL: freeze_struct:
75 ; X86ASM-NEXT: addl %eax, %eax
77 %y1 = freeze %struct.T undef
78 %v1 = extractvalue %struct.T %y1, 0
79 %v2 = extractvalue %struct.T %y1, 1
80 %t1 = add i32 %v1, %v2
84 define i32 @freeze_anonstruct() {
85 ; X86ASM-LABEL: freeze_anonstruct:
87 ; X86ASM-NEXT: addl %eax, %eax
89 %y1 = freeze {i32, i32} undef
90 %v1 = extractvalue {i32, i32} %y1, 0
91 %v2 = extractvalue {i32, i32} %y1, 1
92 %t1 = add i32 %v1, %v2
96 define i32 @freeze_anonstruct2() {
97 ; X86ASM-LABEL: freeze_anonstruct2:
99 ; X86ASM-NEXT: movzwl %ax, %eax
100 ; X86ASM-NEXT: addl %eax, %eax
102 %y1 = freeze {i32, i16} undef
103 %v1 = extractvalue {i32, i16} %y1, 0
104 %v2 = extractvalue {i32, i16} %y1, 1
105 %z2 = zext i16 %v2 to i32
106 %t1 = add i32 %v1, %z2
110 define i64 @freeze_array() {
111 ; X86ASM-LABEL: freeze_array:
113 ; X86ASM-NEXT: addq %rax, %rax
115 %y1 = freeze [2 x i64] undef
116 %v1 = extractvalue [2 x i64] %y1, 0
117 %v2 = extractvalue [2 x i64] %y1, 1
118 %t1 = add i64 %v1, %v2
122 ; Make sure we emit a movl to zext the input before the imulq. This previously
123 ; failed because freeze was not listed in the instructions that don't zext their
124 ; result in the def32 pattern X86InstrCompiler.td.
125 define i32 @freeze_zext(i64 %a) nounwind {
126 ; X86ASM-LABEL: freeze_zext:
127 ; X86ASM: # %bb.0: # %entry
128 ; X86ASM-NEXT: movq %rdi, %rax
129 ; X86ASM-NEXT: movl %eax, %ecx
130 ; X86ASM-NEXT: movl $3435973837, %edx # imm = 0xCCCCCCCD
131 ; X86ASM-NEXT: imulq %rcx, %rdx
132 ; X86ASM-NEXT: shrq $35, %rdx
133 ; X86ASM-NEXT: addl %edx, %edx
134 ; X86ASM-NEXT: leal (%rdx,%rdx,4), %ecx
135 ; X86ASM-NEXT: subl %ecx, %eax
136 ; X86ASM-NEXT: # kill: def $eax killed $eax killed $rax
139 %x = trunc i64 %a to i32