[llvm] [RISCV] Add register bank and instruction selection support for FP G_SELECT. (PR #72726)
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 27 07:30:26 PST 2023
================
@@ -0,0 +1,34 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple=riscv32 -mattr=+d -run-pass=regbankselect \
+# RUN: -disable-gisel-legality-check -simplify-mir -verify-machineinstrs %s \
+# RUN: -o - | FileCheck -check-prefix=RV32I %s
+
+---
+name: fp_select_s32
+legalized: true
+tracksRegLiveness: true
+body: |
+ bb.0.entry:
+ liveins: $x10, $f10_f, $f11_f
+
+ ; RV32I-LABEL: name: fp_select_s32
+ ; RV32I: liveins: $x10, $f10_f, $f11_f
+ ; RV32I-NEXT: {{ $}}
+ ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
+ ; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
+ ; RV32I-NEXT: [[COPY2:%[0-9]+]]:fprb(s32) = COPY $f11_f
+ ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
+ ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY]], [[C]]
+ ; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
+ ; RV32I-NEXT: $f10_f = COPY [[SELECT]](s32)
+ ; RV32I-NEXT: PseudoRET implicit $f10_f
+ %3:_(s32) = COPY $x10
+ %4:_(s32) = COPY $f10_f
+ %5:_(s32) = COPY $f11_f
+ %12:_(s32) = G_CONSTANT i32 1
+ %11:_(s32) = G_AND %3, %12
+ %10:_(s32) = G_SELECT %11(s32), %4, %5
+ $f10_f = COPY %10(s32)
+ PseudoRET implicit $f10_f
+
----------------
michaelmaitland wrote:
Should we test some cases where one of the operands are from onlyDefinesFP but the other operand can be either?
Should we test some cases where the def is used by instructions that onlyDefineFP?
https://github.com/llvm/llvm-project/pull/72726
More information about the llvm-commits
mailing list