Issue 56461
Summary LLVM 14 Regression: Bad `fptoui` result when targeting `x86_64-windows-gnu`
Labels new issue
Assignees
Reporter topolarity
    Bad float to int conversion when targeting `x86_64-windows-gnu`:

```llvm
; ModuleID = 'test'
source_filename = "test"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-windows-gnu"

; Function Attrs: nobuiltin nounwind uwtable
define external fastcc i16 @"wWinMainCRTStartup"() unnamed_addr #1 {
Entry:
  %x = alloca double, align 8
  store double 152314000000000000407048814592.0, double* %x, align 8
  %0 = load double, double* %x, align 8
  %1 = fptoui double %0 to i128
  %2 = icmp ne i128 %1, 152314000000000000407048814592
  %3 = zext i1 %2 to i32
  call void @ExitProcess(i32 %3)
  unreachable
}

; Function Attrs: nobuiltin noreturn nounwind uwtable
declare void @ExitProcess(i32 %0) #2
```

This exits with 0 in LLVM 13.0.1, but returns 1 with LLVM 14.0.5 and trunk.

(Note that `152314000000000000407048814592` is exactly representable in both `f64` and `u128`)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to