fallback: legalize: G_CLMULH

Run:explore-d9924131a4-20261128-105811
Kind:fallback
Category:legalize: G_CLMULH M
Occurrences:3 in 1 configs, 1 test files, 108 more counted only
Snippet from:clmul-rv64.99a283a138.ll (mutant of clmul-rv64.ll) @clmulh_i32 via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -O3
Local check:reproduces at d9924131a4
Compiler Explorer:not uploaded (over --godbolt-limit or disabled)

Snippet:

@G.2 = external global i32
@G.3 = external global i1
@G.4 = external global i1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.riscv.clmulh.i32(i32, i32) #0

define signext i32 @clmulh_i32(i32 signext %a, i32 signext %b) {
  %A = alloca i1, align 1
  store i1 false, ptr %A, align 1
  %LGV = load i32, ptr @G.2, align 4
  %r = call i32 @llvm.riscv.clmulh.i32(i32 %a, i32 %b)
  switch i32 %LGV, label %SW_D [
    i32 71302304, label %SW_C
    i32 1113144990, label %SW_C1
    i32 -1929723608, label %SW_C2
  ]

BB:                                               ; preds = %SW_C2, %SW_C1, %SW_C, %SW_D
  ret i32 %r

SW_D:                                             ; preds = %SW_D, %0
  %LGV3 = load i1, ptr @G.3, align 1
  br i1 %LGV3, label %BB, label %SW_D

SW_C:                                             ; preds = %SW_C, %0
  %LGV4 = load i1, ptr @G.4, align 1
  br i1 %LGV4, label %SW_C, label %BB

SW_C1:                                            ; preds = %SW_C1, %0
  %LGV5 = load i1, ptr @G.4, align 1
  %L = load i1, ptr %A, align 1
  br i1 %L, label %SW_C1, label %BB

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

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

Reproduce:

llc -mtriple=riscv64 -verify-machineinstrs -O3 -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.* snippet.ll -o -
llc -mtriple=riscv64 -verify-machineinstrs -O3 -global-isel=0 snippet.ll -o -

Local llc output:

remark: <unknown>:0:0: unable to legalize instruction: %10:_(i32) = G_CLMULH %0:_, %1:_ (in function: clmulh_i32)
warning: Instruction selection used fallback path for clmulh_i32

Occurrences (3):

InputFunctionConfig
clmul-rv64.99a283a138.ll (mutant of clmul-rv64.ll)clmulh_i32-mtriple=riscv64 -verify-machineinstrs -O3
clmul-rv64.99a283a138.ll (mutant of clmul-rv64.ll)clmulh_i32_zext-mtriple=riscv64 -verify-machineinstrs -O3
clmul-rv64.99a283a138.ll (mutant of clmul-rv64.ll)clmulh_i64-mtriple=riscv64 -verify-machineinstrs -O3

Generated 2026-11-29 14:49 UTC.