1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-- -mcpu=x86-64 < %s | FileCheck %s
4 define i32 @u8_f32_s32(i8 %a) {
5 ; CHECK-LABEL: u8_f32_s32:
7 ; CHECK-NEXT: movzbl %dil, %eax
9 %conv = uitofp i8 %a to float
10 %conv1 = fptosi float %conv to i32
14 define i32 @s8_f32_s32(i8 %a) {
15 ; CHECK-LABEL: s8_f32_s32:
17 ; CHECK-NEXT: movsbl %dil, %eax
19 %conv = sitofp i8 %a to float
20 %conv1 = fptosi float %conv to i32
24 define zeroext i8 @u8_f32_u8(i8 zeroext %a) {
25 ; CHECK-LABEL: u8_f32_u8:
27 ; CHECK-NEXT: movl %edi, %eax
28 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
30 %conv = uitofp i8 %a to float
31 %conv1 = fptoui float %conv to i8
35 define i32 @s32_f32_s24_s32(i32 %a) {
36 ; CHECK-LABEL: s32_f32_s24_s32:
38 ; CHECK-NEXT: movl %edi, %eax
39 ; CHECK-NEXT: shll $8, %eax
40 ; CHECK-NEXT: sarl $8, %eax
42 %f = sitofp i32 %a to float
43 %i = fptosi float %f to i24
44 %r = sext i24 %i to i32
48 define i32 @s32_f32_u24_u32(i32 %a) {
49 ; CHECK-LABEL: s32_f32_u24_u32:
51 ; CHECK-NEXT: movl %edi, %eax
52 ; CHECK-NEXT: andl $16777215, %eax # imm = 0xFFFFFF
54 %f = sitofp i32 %a to float
55 %i = fptoui float %f to i24
56 %r = zext i24 %i to i32
60 define i32 @u32_f32_s24_s32(i32 %a) {
61 ; CHECK-LABEL: u32_f32_s24_s32:
63 ; CHECK-NEXT: movl %edi, %eax
64 ; CHECK-NEXT: shll $8, %eax
65 ; CHECK-NEXT: sarl $8, %eax
67 %f = uitofp i32 %a to float
68 %i = fptosi float %f to i24
69 %r = sext i24 %i to i32
73 define i32 @u32_f32_u24_u32(i32 %a) {
74 ; CHECK-LABEL: u32_f32_u24_u32:
76 ; CHECK-NEXT: movl %edi, %eax
77 ; CHECK-NEXT: andl $16777215, %eax # imm = 0xFFFFFF
79 %f = uitofp i32 %a to float
80 %i = fptoui float %f to i24
81 %r = zext i24 %i to i32
85 ; This requires converting to FP and back.
87 define i32 @s32_f32_s25_s32(i32 %a) {
88 ; CHECK-LABEL: s32_f32_s25_s32:
90 ; CHECK-NEXT: cvtsi2ss %edi, %xmm0
91 ; CHECK-NEXT: cvttss2si %xmm0, %eax
93 %f = sitofp i32 %a to float
94 %i = fptosi float %f to i25
95 %r = sext i25 %i to i32
99 define i32 @s32_f32_u25_u32(i32 %a) {
100 ; CHECK-LABEL: s32_f32_u25_u32:
102 ; CHECK-NEXT: cvtsi2ss %edi, %xmm0
103 ; CHECK-NEXT: cvttss2si %xmm0, %eax
105 %f = sitofp i32 %a to float
106 %i = fptoui float %f to i25
107 %r = zext i25 %i to i32
111 ; TODO: This could avoid converting to FP.
113 define i32 @u32_f32_s25_s32(i32 %a) {
114 ; CHECK-LABEL: u32_f32_s25_s32:
116 ; CHECK-NEXT: movl %edi, %eax
117 ; CHECK-NEXT: cvtsi2ss %rax, %xmm0
118 ; CHECK-NEXT: cvttss2si %xmm0, %eax
120 %f = uitofp i32 %a to float
121 %i = fptosi float %f to i25
122 %r = sext i25 %i to i32
126 define i32 @u32_f32_u25_u32(i32 %a) {
127 ; CHECK-LABEL: u32_f32_u25_u32:
129 ; CHECK-NEXT: movl %edi, %eax
130 ; CHECK-NEXT: cvtsi2ss %rax, %xmm0
131 ; CHECK-NEXT: cvttss2si %xmm0, %eax
133 %f = uitofp i32 %a to float
134 %i = fptoui float %f to i25
135 %r = zext i25 %i to i32