miscompile: miscompile rv64: add,addi,and,andi,csrr,fcvt.l.d

Run:explore-db12fc36f6-20261127-115111
Kind:miscompile
Category:miscompile rv64: add,addi,and,andi,csrr,fcvt.l.d NEW M
Occurrences:1 in 1 configs, 1 test files
Snippet from:double-round-conv.547dac36.6764b4e3.0a74aa11c6.ll (mutant of double-round-conv.547dac36.6764b4e3.ll) @test_trunc_si16 via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+zvkb,+m,+zve64d -O0
Local check:reproduces at db12fc36f6
Compiler Explorer:not applicable: Compiler Explorer compiles RISC-V but cannot run it

Snippet:

@G = external global double
@G.1 = external global i1
@G.3 = external global i1
@G.5 = external global <4 x i32>

define signext i16 @test_trunc_si16(double %x) {
  %A = alloca i1, align 1
  store i1 true, ptr %A, align 1
  %LGV2 = load i1, ptr @G.3, align 1
  %LGV = load double, ptr @G, align 8
  %a = call double @llvm.trunc.f64(double %x)
  %b = fptosi double %a to i16
  %C = fcmp uno double %a, %LGV
  %B = lshr <4 x i32> splat (i32 -1), splat (i32 -2147483648)
  %C1 = fcmp ule double %x, %x
  store i1 %C, ptr @G.1, align 1
  %L = load i1, ptr %A, align 1
  br i1 %L, label %T, label %F

BB:                                               ; preds = %F, %T
  store i1 %C1, ptr @G.1, align 1
  store <4 x i32> %B, ptr @G.5, align 16
  ret i16 %b

T:                                                ; preds = %0
  br label %BB

F:                                                ; preds = %0
  br label %BB
}

; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.trunc.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,+zvkb,+m,+zve64d -O0' --funcs test_trunc_si16 snippet.ll

Local execution result:

3 of 64 inputs differ (first: #12)
SelectionDAG hash 35a83a8c39022ab9, GlobalISel hash 4a0c640c306e95b7
b0: llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+zvkb,+m,+zve64d -O0 -global-isel=0
b1: llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+zvkb,+m,+zve64d -O2 -global-isel=0
b2: llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+zvkb,+m,+zve64d -O0 -global-isel -global-isel-abort=2

Occurrences (1):

InputFunctionConfig
double-round-conv.547dac36.6764b4e3.0a74aa11c6.ll (mutant of double-round-conv.547dac36.6764b4e3.ll)test_trunc_si16-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -mattr=+d,+zvkb,+m,+zve64d -O0

Generated 2026-11-29 14:49 UTC.