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

Run:explore-d9924131a4-20261128-105811
Kind:miscompile
Category:miscompile rv64: addi,andi,beq,beqz,bge,blt M
Occurrences:1 in 1 configs, 1 test files
Snippet from:double-round-conv.0effb563.ad68cb8a.6582491617.ll (mutant of double-round-conv.0effb563.ad68cb8a.ll) @test_floor_si8 via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+zvfh,+zbkb -O2
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 i16

define signext i8 @test_floor_si8(double %x) {
  %A14 = alloca i1, align 1
  store i1 poison, ptr %A14, align 1
  %A10 = alloca i1, align 1
  store i1 true, ptr %A10, align 1
  %A3 = alloca i8, align 1
  store i8 0, ptr %A3, align 1
  %A2 = alloca i1, align 1
  store i1 false, ptr %A2, align 1
  %LGV = load i16, ptr @G.2, align 2
  %A = alloca double, align 8
  store double poison, ptr %A, align 8
  %a = call double @llvm.floor.f64(double %x)
  switch i16 %LGV, label %SW_D [
    i16 13399, label %SW_C
  ]

BB:                                               ; preds = %BB1, %SW_D
  %B = fadd double %x, %x
  %b = fptosi double %a to i8
  store double %B, ptr %A, align 8
  ret i8 %b

SW_D:                                             ; preds = %SW_D, %0
  %L = load i1, ptr %A2, align 1
  br i1 %L, label %SW_D, label %BB

SW_C:                                             ; preds = %0
  %C = fcmp false double %a, 4.200000e+01
  %L4 = load i8, ptr %A3, align 1
  switch i8 %L4, label %SW_D5 [
    i8 -85, label %SW_C6
    i8 87, label %SW_C7
    i8 -32, label %SW_C8
    i8 108, label %SW_C9
  ]

BB1:                                              ; preds = %SW_C9, %SW_C8, %SW_C6, %SW_D5
  store i1 %C, ptr @G, align 1
  br label %BB

SW_D5:                                            ; preds = %SW_C
  %C13 = fcmp ueq double %x, %x
  store i1 %C13, ptr %A14, align 1
  br label %BB1

SW_C6:                                            ; preds = %SW_C6, %SW_C
  br i1 %C, label %BB1, label %SW_C6

SW_C7:                                            ; preds = %SW_C
  ret i8 %L4

SW_C8:                                            ; preds = %SW_C
  br label %BB1

SW_C9:                                            ; preds = %SW_C9, %SW_C
  %L11 = load i1, ptr %A10, align 1
  br i1 %L11, label %BB1, label %SW_C9
}

; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #0

attributes #0 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }

Reproduce:

./exec_oracle.py --flags '-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+zvfh,+zbkb -O2' --funcs test_floor_si8 snippet.ll

Local execution result:

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

Occurrences (1):

InputFunctionConfig
double-round-conv.0effb563.ad68cb8a.6582491617.ll (mutant of double-round-conv.0effb563.ad68cb8a.ll)test_floor_si8-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+zvfh,+zbkb -O2

Generated 2026-11-29 14:49 UTC.