CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
79 lines
3.2 KiB
TableGen
79 lines
3.2 KiB
TableGen
//===-- RISCVInstrInfoZfbfmin.td - 'Zfbfmin' instructions --*- tablegen -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file describes the RISC-V instructions from the standard 'Zfbfmin'
|
|
// extension, providing scalar conversion instructions for BFloat16.
|
|
// This version is still experimental as the 'Zfbfmin' extension hasn't been
|
|
// ratified yet.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Instructions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
let Predicates = [HasStdExtZfbfmin] in {
|
|
def FCVT_BF16_S : FPUnaryOp_r_frm<0b0100010, 0b01000, FPR16, FPR32, "fcvt.bf16.s">,
|
|
Sched<[WriteFCvtF32ToF16, ReadFCvtF32ToF16]>;
|
|
def FCVT_S_BF16 : FPUnaryOp_r_frmlegacy<0b0100000, 0b00110, FPR32, FPR16, "fcvt.s.bf16">,
|
|
Sched<[WriteFCvtF16ToF32, ReadFCvtF16ToF32]>;
|
|
} // Predicates = [HasStdExtZfbfmin]
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Pseudo-instructions and codegen patterns
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
let Predicates = [HasStdExtZfbfmin] in {
|
|
def : Pat<(riscv_selectcc (XLenVT GPR:$lhs), GPR:$rhs, cond:$cc,
|
|
(bf16 FPR16:$truev), FPR16:$falsev),
|
|
(Select_FPR16_Using_CC_GPR GPR:$lhs, GPR:$rhs,
|
|
(CCtoRISCVCC $cc), FPR16:$truev, FPR16:$falsev)>;
|
|
|
|
// Explicitly select 0 in the condition to X0. The register coalescer doesn't
|
|
// always do it.
|
|
def : Pat<(riscv_selectcc (XLenVT GPR:$lhs), 0, cond:$cc,
|
|
(bf16 FPR16:$truev), FPR16:$falsev),
|
|
(Select_FPR16_Using_CC_GPR GPR:$lhs, (XLenVT X0),
|
|
(CCtoRISCVCC $cc), FPR16:$truev, FPR16:$falsev)>;
|
|
|
|
/// Loads
|
|
def : LdPat<load, FLH, bf16>;
|
|
|
|
/// Stores
|
|
def : StPat<store, FSH, FPR16, bf16>;
|
|
|
|
/// Float conversion operations
|
|
// f32 -> bf16, bf16 -> f32
|
|
def : Pat<(bf16 (fpround FPR32:$rs1)),
|
|
(FCVT_BF16_S FPR32:$rs1, FRM_DYN)>;
|
|
def : Pat<(fpextend (bf16 FPR16:$rs1)),
|
|
(FCVT_S_BF16 FPR16:$rs1, FRM_RNE)>;
|
|
|
|
// Moves (no conversion)
|
|
def : Pat<(bf16 (riscv_fmv_h_x GPR:$src)), (FMV_H_X GPR:$src)>;
|
|
def : Pat<(riscv_fmv_x_anyexth (bf16 FPR16:$src)), (FMV_X_H FPR16:$src)>;
|
|
def : Pat<(riscv_fmv_x_signexth (bf16 FPR16:$src)), (FMV_X_H FPR16:$src)>;
|
|
} // Predicates = [HasStdExtZfbfmin]
|
|
|
|
let Predicates = [HasStdExtZfbfmin, HasStdExtD] in {
|
|
// f64 -> bf16
|
|
// FIXME: This pattern double rounds.
|
|
def : Pat<(bf16 (fpround FPR64:$rs1)),
|
|
(FCVT_BF16_S (FCVT_S_D FPR64:$rs1, FRM_DYN), FRM_DYN)>;
|
|
// bf16 -> f64
|
|
def : Pat<(fpextend (bf16 FPR16:$rs1)),
|
|
(FCVT_D_S (FCVT_S_BF16 FPR16:$rs1, FRM_DYN), FRM_RNE)>;
|
|
}
|
|
|
|
let Predicates = [HasStdExtZfhmin, HasStdExtZfbfmin] in {
|
|
// bf16 -> f16
|
|
def : Pat<(f16 (bitconvert (bf16 FPR16:$src))), (f16 FPR16:$src)>;
|
|
// f16 -> bf16
|
|
def : Pat<(bf16 (bitconvert (f16 FPR16:$src))), (bf16 FPR16:$src)>;
|
|
}
|