xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/float-conv-elim.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=i686-unknown-linux-gnu -march=x86-64 -mcpu=x86-64 < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Make sure the float conversion is folded away as it should be.
4*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo
5*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: cvt
6*9880d681SAndroid Build Coastguard Worker; CHECK: movzbl
7*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(i8 %a) #0 {
8*9880d681SAndroid Build Coastguard Worker  %conv = uitofp i8 %a to float
9*9880d681SAndroid Build Coastguard Worker  %conv1 = fptosi float %conv to i32
10*9880d681SAndroid Build Coastguard Worker  ret i32 %conv1
11*9880d681SAndroid Build Coastguard Worker}
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo2
14*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: cvt
15*9880d681SAndroid Build Coastguard Worker; CHECK: movsbl
16*9880d681SAndroid Build Coastguard Workerdefine i32 @foo2(i8 %a) #0 {
17*9880d681SAndroid Build Coastguard Worker  %conv = sitofp i8 %a to float
18*9880d681SAndroid Build Coastguard Worker  %conv1 = fptosi float %conv to i32
19*9880d681SAndroid Build Coastguard Worker  ret i32 %conv1
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: bar
23*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: cvt
24*9880d681SAndroid Build Coastguard Worker; CHECK: movl
25*9880d681SAndroid Build Coastguard Workerdefine zeroext i8 @bar(i8 zeroext %a) #0 {
26*9880d681SAndroid Build Coastguard Worker  %conv = uitofp i8 %a to float
27*9880d681SAndroid Build Coastguard Worker  %conv1 = fptoui float %conv to i8
28*9880d681SAndroid Build Coastguard Worker  ret i8 %conv1
29*9880d681SAndroid Build Coastguard Worker}
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
32*9880d681SAndroid Build Coastguard Worker
33