llvm-project/llvm/test/Integer/fold-fpcast_bt.ll
Nikita Popov 17764d2c87
[IR] Remove FP cast constant expressions (#71408)
Remove support for the fptrunc, fpext, fptoui, fptosi, uitofp and sitofp
constant expressions. All places creating them have been removed
beforehand, so this just removes the APIs and uses of these constant
expressions in tests.

With this, the only remaining FP operation that still has constant
expression support is fcmp.

This is part of
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179.
2023-11-07 09:34:16 +01:00

63 lines
1.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
; RUN: opt -S -passes=instsimplify < %s | FileCheck %s
define i60 @test1() {
; CHECK-LABEL: define i60 @test1() {
; CHECK-NEXT: ret i60 3
;
%fptoui = fptoui float 0x400D9999A0000000 to i60
ret i60 %fptoui
}
define float @test2() {
; CHECK-LABEL: define float @test2() {
; CHECK-NEXT: ret float 1.700000e+01
;
%uitofp = uitofp i60 17 to float
ret float %uitofp
}
define i64 @test3() {
; CHECK-LABEL: define i64 @test3() {
; CHECK-NEXT: ret i64 4614256656431372362
;
ret i64 bitcast (double 0x400921FB4D12D84A to i64)
}
define double @test4() {
; CHECK-LABEL: define double @test4() {
; CHECK-NEXT: ret double 2.075080e-322
;
ret double bitcast (i64 42 to double)
}
define i30 @test5() {
; CHECK-LABEL: define i30 @test5() {
; CHECK-NEXT: ret i30 3
;
%fptoui = fptoui float 0x400D9999A0000000 to i30
ret i30 %fptoui
}
define float @test6() {
; CHECK-LABEL: define float @test6() {
; CHECK-NEXT: ret float 1.700000e+01
;
%uitofp = uitofp i30 17 to float
ret float %uitofp
}
define i64 @test7() {
; CHECK-LABEL: define i64 @test7() {
; CHECK-NEXT: ret i64 4614256656431372362
;
ret i64 bitcast (double 0x400921FB4D12D84A to i64)
}
define double @test8() {
; CHECK-LABEL: define double @test8() {
; CHECK-NEXT: ret double 2.075080e-322
;
ret double bitcast (i64 42 to double)
}