Issue 115072
Summary [EarlyCSE] Optimization ignores specified floating point rounding mode
Labels new issue
Assignees
Reporter patrick-rivos
    Testcase:
```llvm ir
define float @test() {
  call void @llvm.set.rounding(i32 2)   ;; Round up
  %a = bitcast i32 1 to float           ;; 1e-45
  %b = bitcast i32 u0x3F800000 to float ;; 1.0
  %res = fadd float %a, %b
  ret float %res
}
```

The optimized version is:
```llvm ir
define float @test() {
  call void @llvm.set.rounding(i32 2)
  ret float 1.000000e+00
}
```

IIUC this ignores the specified rounding mode since it rounds down the result of the fadd.

Godbolt: https://godbolt.org/z/471Ph5EWP
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to