miscompile: miscompile rv64: addi,and,andi,fcvt.lu.d,fcvt.wu.d,feq.d

Run:explore-d9924131a4-20261128-105811
Kind:miscompile
Category:miscompile rv64: addi,and,andi,fcvt.lu.d,fcvt.wu.d,feq.d M
Occurrences:1 in 1 configs, 1 test files
Snippet from:double-convert.6a9e415f.b4b991a3.234cbd22.03a49e3e.9a6eea92f0.ll (mutant of double-convert.6a9e415f.b4b991a3.234cbd22.03a49e3e.ll) @fcvt_wu_s_i8 via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+a,+zicond -O0
Local check:reproduces at d9924131a4
Compiler Explorer:not applicable: Compiler Explorer compiles RISC-V but cannot run it

Snippet:

@G = external global i1
@G.2 = external global i1
@G.7 = external global i8
@G.8 = external global i1
@G.9 = external global i1
@G.10 = external global i128

; Function Attrs: nounwind
define zeroext i8 @fcvt_wu_s_i8(double %a) #0 {
  %A23 = alloca ptr, align 8
  store ptr poison, ptr %A23, align 8
  %A18 = alloca i1, align 1
  store i1 true, ptr %A18, align 1
  %A16 = alloca i1, align 1
  store i1 true, ptr %A16, align 1
  %A13 = alloca i1, align 1
  store i1 false, ptr %A13, align 1
  %A3 = alloca i16, align 2
  store i16 1, ptr %A3, align 2
  %A = alloca i8, align 1
  store i8 1, ptr %A, align 1
  %L = load i8, ptr %A, align 1
  %C24 = fcmp ule double %a, %a
  store i1 %C24, ptr @G, align 1
  switch i8 %L, label %SW_D [
    i8 62, label %SW_C
    i8 -28, label %SW_C1
  ]

BB:                                               ; preds = %BB1, %SW_D
  %1 = fptoui double %a to i8
  %C = icmp ugt i8 %1, %1
  store i1 %C, ptr @G.2, align 1
  ret i8 %1

SW_D:                                             ; preds = %0
  br label %BB

SW_C:                                             ; preds = %0
  %L4 = load i16, ptr %A3, align 2
  switch i16 %L4, label %SW_D5 [
    i16 -8279, label %SW_C6
    i16 -16899, label %SW_C7
    i16 9300, label %SW_C8
    i16 -5314, label %SW_C9
    i16 22356, label %SW_C10
    i16 -7438, label %SW_C11
    i16 -7004, label %SW_C12
  ]

BB2:                                              ; preds = %SW_C11, %SW_C10, %SW_C8, %SW_C7, %SW_C6, %SW_D5
  %LGV2 = load i1, ptr @G.8, align 1
  %G = getelementptr <4 x i32>, ptr %A, i8 %L
  store ptr %G, ptr %A, align 8
  br i1 %LGV2, label %T, label %F

BB1:                                              ; preds = %T
  br label %BB

SW_C1:                                            ; preds = %0
  %LGV = load i8, ptr @G.7, align 1
  %G1 = getelementptr double, ptr %A, i8 %L
  %C3 = icmp ne i8 %LGV, %LGV
  store i1 %C3, ptr poison, align 1
  store ptr %G1, ptr %A, align 8
  ret i8 %LGV

T:                                                ; preds = %BB2
  %C25 = fcmp uno double +qnan, 4.940660e-324
  store i1 %C25, ptr %G, align 1
  br label %BB1

F:                                                ; preds = %BB2
  ret i8 0

SW_D5:                                            ; preds = %SW_D5, %SW_C
  %L14 = load i1, ptr %A13, align 1
  br i1 %L14, label %BB2, label %SW_D5

SW_C6:                                            ; preds = %SW_C
  br label %BB2

SW_C7:                                            ; preds = %SW_C7, %SW_C
  %LGV15 = load i1, ptr @G.9, align 1
  br i1 %LGV15, label %BB2, label %SW_C7

SW_C8:                                            ; preds = %SW_C8, %SW_C
  %LGV21 = load i128, ptr @G.10, align 4
  %L17 = load i1, ptr %A16, align 1
  %G22 = getelementptr i16, ptr %A13, i128 %LGV21
  store ptr %G22, ptr %A23, align 8
  br i1 %L17, label %SW_C8, label %BB2

SW_C9:                                            ; preds = %SW_C
  ret i8 %L

SW_C10:                                           ; preds = %SW_C10, %SW_C
  %L19 = load i1, ptr %A18, align 1
  br i1 %L19, label %SW_C10, label %BB2

SW_C11:                                           ; preds = %SW_C
  br label %BB2

SW_C12:                                           ; preds = %SW_C
  ret i8 %L
}

attributes #0 = { nounwind }

Reproduce:

./exec_oracle.py --flags '-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+a,+zicond -O0' --funcs fcvt_wu_s_i8 snippet.ll

Local execution result:

9 of 64 inputs differ (first: #12)
SelectionDAG hash 7671f9994d454daf, GlobalISel hash 5289e0e02a921a1b
b0: llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+a,+zicond -O0 -global-isel=0
b1: llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+a,+zicond -O2 -global-isel=0
b2: llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+a,+zicond -O0 -global-isel -global-isel-abort=2

Occurrences (1):

InputFunctionConfig
double-convert.6a9e415f.b4b991a3.234cbd22.03a49e3e.9a6eea92f0.ll (mutant of double-convert.6a9e415f.b4b991a3.234cbd22.03a49e3e.ll)fcvt_wu_s_i8-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+a,+zicond -O0

Generated 2026-11-29 14:49 UTC.