Skip to content

[RISC-V] llvm.*maximum/llvm.*minimum can't be lowered to soft floats #70061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dcaballe opened this issue Oct 24, 2023 · 3 comments
Closed

[RISC-V] llvm.*maximum/llvm.*minimum can't be lowered to soft floats #70061

dcaballe opened this issue Oct 24, 2023 · 3 comments
Labels
backend:RISC-V bug Indicates an unexpected problem or unintended behavior duplicate Resolved as duplicate

Comments

@dcaballe
Copy link
Contributor

Hi there,

It looks like llvm.maximum and llvm.vector.reduce.fmaximum (and I assume the minimum counterparts as well) can't be lowered to soft floats.

Repro:

define float @test(<4 x float> %in, float %in2, float %in3) {
  %mr = tail call float @llvm.vector.reduce.fmaximum.v4f32(<4 x float> %in)
  %m = tail call float @llvm.maximum.f32(float %in2, float %in3)
  %res = fadd float %m, %mr
  ret float %res
}

declare float @llvm.vector.reduce.fmaximum.v4f32(<4 x float>)

declare float @llvm.maximum.f32(float, float)
llc -mattr=+m -mtriple=riscv32-pc-linux-elf -target-abi=ilp32 test.ll

SoftenFloatResult #0: t46: f32 = fmaximum t35, t34

LLVM ERROR: Do not know how to soften the result of this operator!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc -mattr=+m -mtriple=riscv32-pc-linux-elf -target-abi=ilp32 test.ll
1.      Running pass 'Function Pass Manager' on module 'test.ll'.
2.      Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@test'
@dcaballe dcaballe added bug Indicates an unexpected problem or unintended behavior backend:RISC-V labels Oct 24, 2023
@llvmbot
Copy link
Member

llvmbot commented Oct 24, 2023

@llvm/issue-subscribers-backend-risc-v

Author: Diego Caballero (dcaballe)

Hi there,

It looks like llvm.maximum and llvm.vector.reduce.fmaximum (and I assume the minimum counterparts as well) can't be lowered to soft floats.

Repro:

define float @<!-- -->test(&lt;4 x float&gt; %in, float %in2, float %in3) {
  %mr = tail call float @<!-- -->llvm.vector.reduce.fmaximum.v4f32(&lt;4 x float&gt; %in)
  %m = tail call float @<!-- -->llvm.maximum.f32(float %in2, float %in3)
  %res = fadd float %m, %mr
  ret float %res
}

declare float @<!-- -->llvm.vector.reduce.fmaximum.v4f32(&lt;4 x float&gt;)

declare float @<!-- -->llvm.maximum.f32(float, float)
llc -mattr=+m -mtriple=riscv32-pc-linux-elf -target-abi=ilp32 test.ll

SoftenFloatResult #<!-- -->0: t46: f32 = fmaximum t35, t34

LLVM ERROR: Do not know how to soften the result of this operator!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc -mattr=+m -mtriple=riscv32-pc-linux-elf -target-abi=ilp32 test.ll
1.      Running pass 'Function Pass Manager' on module 'test.ll'.
2.      Running pass 'RISC-V DAG-&gt;DAG Pattern Instruction Selection' on function '@<!-- -->test'

@llvmbot
Copy link
Member

llvmbot commented Oct 24, 2023

@llvm/issue-subscribers-bug

Author: Diego Caballero (dcaballe)

Hi there,

It looks like llvm.maximum and llvm.vector.reduce.fmaximum (and I assume the minimum counterparts as well) can't be lowered to soft floats.

Repro:

define float @<!-- -->test(&lt;4 x float&gt; %in, float %in2, float %in3) {
  %mr = tail call float @<!-- -->llvm.vector.reduce.fmaximum.v4f32(&lt;4 x float&gt; %in)
  %m = tail call float @<!-- -->llvm.maximum.f32(float %in2, float %in3)
  %res = fadd float %m, %mr
  ret float %res
}

declare float @<!-- -->llvm.vector.reduce.fmaximum.v4f32(&lt;4 x float&gt;)

declare float @<!-- -->llvm.maximum.f32(float, float)
llc -mattr=+m -mtriple=riscv32-pc-linux-elf -target-abi=ilp32 test.ll

SoftenFloatResult #<!-- -->0: t46: f32 = fmaximum t35, t34

LLVM ERROR: Do not know how to soften the result of this operator!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc -mattr=+m -mtriple=riscv32-pc-linux-elf -target-abi=ilp32 test.ll
1.      Running pass 'Function Pass Manager' on module 'test.ll'.
2.      Running pass 'RISC-V DAG-&gt;DAG Pattern Instruction Selection' on function '@<!-- -->test'

@dtcxzyw
Copy link
Member

dtcxzyw commented Oct 24, 2023

Duplicate of #64206.

@dcaballe dcaballe closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2023
@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:RISC-V bug Indicates an unexpected problem or unintended behavior duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

4 participants