xref: /aosp_15_r20/external/llvm/test/Transforms/Float2Int/toolarge.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -float2int -float2int-max-integer-bw=256 -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @neg_toolarge
4*9880d681SAndroid Build Coastguard Worker; CHECK:  %1 = uitofp i80 %a to fp128
5*9880d681SAndroid Build Coastguard Worker; CHECK:  %2 = fadd fp128 %1, %1
6*9880d681SAndroid Build Coastguard Worker; CHECK:  %3 = fptoui fp128 %2 to i80
7*9880d681SAndroid Build Coastguard Worker; CHECK:  ret i80 %3
8*9880d681SAndroid Build Coastguard Worker; fp128 has a 112-bit mantissa, which can hold an i80. But we only support
9*9880d681SAndroid Build Coastguard Worker; up to i64, so it should fail (even though the max integer bitwidth is 256).
10*9880d681SAndroid Build Coastguard Workerdefine i80 @neg_toolarge(i80 %a) {
11*9880d681SAndroid Build Coastguard Worker  %1 = uitofp i80 %a to fp128
12*9880d681SAndroid Build Coastguard Worker  %2 = fadd fp128 %1, %1
13*9880d681SAndroid Build Coastguard Worker  %3 = fptoui fp128 %2 to i80
14*9880d681SAndroid Build Coastguard Worker  ret i80 %3
15*9880d681SAndroid Build Coastguard Worker}
16*9880d681SAndroid Build Coastguard Worker
17