The full fold is one of the following:
1) `(fp_binop ({s|u}itofp x), ({s|u}itofp y))`
-> `({s|u}itofp (int_binop x, y))`
2) `(fp_binop ({s|u}itofp x), FpC)`
-> `({s|u}itofp (int_binop x, (fpto{s|u}i FpC)))`
And support the following binops:
`fmul` -> `mul`
`fadd` -> `add`
`fsub` -> `sub`
Proofs: https://alive2.llvm.org/ce/z/zuacA8
The proofs timeout, so they must be reproduced locally.
Closes #82555
20 lines
801 B
LLVM
20 lines
801 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -passes=instcombine -S %s | FileCheck %s
|
|
|
|
@g1 = external global i16
|
|
@g2 = external global i16
|
|
|
|
define float @patatino() {
|
|
; CHECK-LABEL: @patatino(
|
|
; CHECK-NEXT: [[FMUL:%.*]] = uitofp i1 mul (i1 icmp eq (ptr getelementptr inbounds (i16, ptr @g2, i64 1), ptr @g1), i1 icmp eq (ptr getelementptr inbounds (i16, ptr @g2, i64 1), ptr @g1)) to float
|
|
; CHECK-NEXT: ret float [[FMUL]]
|
|
;
|
|
%uitofp1 = uitofp i1 icmp eq (ptr getelementptr inbounds (i16, ptr @g2, i64 1), ptr @g1) to float
|
|
%uitofp2 = uitofp i1 icmp eq (ptr getelementptr inbounds (i16, ptr @g2, i64 1), ptr @g1) to float
|
|
%fmul = fmul float %uitofp1, %uitofp2
|
|
%call = call float @fabsf(float %fmul)
|
|
ret float %call
|
|
}
|
|
|
|
declare float @fabsf(float)
|