miscompile: miscompile rv64: add,addi,andi,beq,beqz,bge

Run:explore-b577f07195-20261129-105236
Kind:miscompile
Category:miscompile rv64: add,addi,andi,beq,beqz,bge M
Occurrences:1 in 1 configs, 1 test files
Snippet from:double-convert.6a9e415f.b4b991a3.234cbd22.b04ba64e.d98bec92.290c80f2.61900824.4231506b80.ll (mutant of double-convert.6a9e415f.b4b991a3.234cbd22.b04ba64e.d98bec92.290c80f2.61900824.ll) @fcvt_wu_s_i8 via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+zcb,+zfh,+zve64d -O1
Local check:reproduces at b577f07195
Compiler Explorer:not applicable: Compiler Explorer compiles RISC-V but cannot run it

Snippet:

@G.2 = external global i1
@G.7 = external global i8
@G.9 = external global i64
@G.10 = external global i32
@G.11 = external global <2 x i64>
@G.12 = external global i128
@G.13 = external global ptr
@G.14 = external global double
@G.15 = external global i8
@G.16 = external global i8

; Function Attrs: nounwind
define zeroext i8 @fcvt_wu_s_i8(double %a) #0 {
  %A11 = alloca ptr, align 8
  store ptr poison, ptr %A11, align 8
  %A10 = alloca i1, align 1
  store i1 poison, ptr %A10, align 1
  %A8 = alloca i1, align 1
  store i1 poison, ptr %A8, align 1
  %LGV6 = load double, ptr @G.14, align 8
  %LGV4 = load i128, ptr @G.12, align 4
  %C5 = icmp ugt i128 -170141183460469231731687303715884105728, %LGV4
  %A3 = alloca ptr, align 8
  %L5 = load double, ptr %A3, align 8
  store ptr poison, ptr %A3, align 8
  %A = alloca i8, align 1
  store i8 1, ptr %A, align 1
  %C7 = fcmp oeq double %L5, %LGV6
  %L = load i8, ptr %A, align 1
  store i1 %C7, ptr %A8, align 1
  store ptr %A, ptr %A11, align 8
  switch i8 %L, label %SW_D [
    i8 62, label %SW_C
    i8 -28, label %SW_C1
  ]

BB:                                               ; preds = %BB1, %SW_D
  %LGV1 = load i64, ptr @G.9, align 4
  %1 = fptoui double %a to i8
  %C2 = icmp ne i64 -1, %LGV1
  store i1 %C2, ptr @G.2, align 1
  ret i8 %1

SW_D:                                             ; preds = %0
  br label %BB

SW_C:                                             ; preds = %0
  %G = getelementptr <4 x i32>, ptr %A, i8 %L
  %G4 = getelementptr i8, ptr %G, i8 %L
  store ptr %G, ptr %A, align 8
  store ptr %G4, ptr @G.13, align 8
  store ptr %G4, ptr @G.13, align 8
  br i1 %C5, label %T, label %F

BB1:                                              ; preds = %BB12
  %C9 = fcmp ule double %a, %LGV6
  store i1 %C9, ptr %A10, align 1
  br label %BB

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

T:                                                ; preds = %SW_C
  %LGV13 = load i8, ptr @G.15, align 1
  %LGV3 = load i32, ptr @G.10, align 4
  switch i8 %LGV13, label %SW_D14 [
    i8 -4, label %SW_C15
    i8 -99, label %SW_C16
    i8 -40, label %SW_C17
    i8 -90, label %SW_C18
    i8 -103, label %SW_C19
    i8 50, label %SW_C20
    i8 84, label %SW_C21
  ]

BB12:                                             ; preds = %SW_C21, %BB23, %SW_C17, %SW_C16, %SW_D14
  %G1 = getelementptr ptr, ptr %G, i16 -32768
  %L4 = load i32, ptr %G1, align 4
  %B = add i32 %LGV3, %L4
  store ptr %G1, ptr poison, align 8
  store i32 %B, ptr poison, align 4
  store i32 %LGV3, ptr %A11, align 4
  br label %BB1

F:                                                ; preds = %SW_C
  %C = icmp ult i8 %L, 16
  store i1 %C, ptr poison, align 1
  %B6 = urem <2 x i64> splat (i64 9223372036854775807), splat (i64 4294967296)
  %G2 = getelementptr half, ptr %A, i8 %L
  store ptr %G2, ptr %A3, align 8
  store <2 x i64> %B6, ptr @G.11, align 16
  ret i8 0

SW_D14:                                           ; preds = %T
  br label %BB12

SW_C15:                                           ; preds = %T
  %LGV22 = load i8, ptr @G.16, align 1
  ret i8 %LGV22

SW_C16:                                           ; preds = %T
  br label %BB12

SW_C17:                                           ; preds = %T
  br label %BB12

SW_C18:                                           ; preds = %T
  br i1 %C5, label %T24, label %F25

BB23:                                             ; preds = %T24
  br label %BB12

SW_C19:                                           ; preds = %T
  ret i8 -1

SW_C20:                                           ; preds = %T
  ret i8 -128

SW_C21:                                           ; preds = %T
  br label %BB12

T24:                                              ; preds = %SW_C18
  br label %BB23

F25:                                              ; preds = %SW_C18
  ret i8 %L
}

attributes #0 = { nounwind }

Reproduce:

./exec_oracle.py --flags '-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+zcb,+zfh,+zve64d -O1' --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=+zcb,+zfh,+zve64d -O1 -global-isel=0
b1: llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+zcb,+zfh,+zve64d -O0 -global-isel=0
b2: llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+zcb,+zfh,+zve64d -O1 -global-isel -global-isel-abort=2

Occurrences (1):

InputFunctionConfig
double-convert.6a9e415f.b4b991a3.234cbd22.b04ba64e.d98bec92.290c80f2.61900824.4231506b80.ll (mutant of double-convert.6a9e415f.b4b991a3.234cbd22.b04ba64e.d98bec92.290c80f2.61900824.ll)fcvt_wu_s_i8-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+zcb,+zfh,+zve64d -O1

Generated 2026-11-29 14:49 UTC.