<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64970>64970</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Hexagon] cannot select v8i1 = PTRUE or PFALSE as fcmp result
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          oakrc
      </td>
    </tr>
</table>

<pre>
    Any IR code that contains a fcmp instruction that yields a boolean vector of all true or all false crashes llc.

[Compiler Explorer - PFALSE demo](https://godbolt.org/z/5Wa47G8T5)
[Compiler Explorer - PTRUE demo](https://godbolt.org/z/Yrq5Evzs5)

PFALSE demo code:

```llvm
@G = global <32 x i1> zeroinitializer

define void @test(<32 x half> %A) {
  %C = fcmp ogt <32 x half> %A, <half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00>
  store <32 x i1> %C, ptr @G
  ret void
}
```

PFALSE demo backtrace:

```console
LLVM ERROR: Cannot select: 0x84dfc80: v8i1 = HexagonISD::PFALSE
In function: test
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=hexagon <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@test'
 #0 0x0000000003079ed8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3079ed8)
 #1 0x000000000307782c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fbfcc14b420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fbfcbc0e00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fbfcbbed859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x000000000069e37a llvm::RISCVISAInfo::updateImplication() (.cold) RISCVISAInfo.cpp:0:0
 #6 0x0000000002e5ead4 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e5ead4)
 #7 0x0000000002e641ad llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e641ad)
 #8 0x0000000002e5c137 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e5c137)
 #9 0x0000000002e68a65 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e68a65)
#10 0x0000000002e6b4b9 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e6b4b9)
#11 0x0000000002e6db86 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#12 0x000000000124ba66 llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x124ba66)
#13 0x0000000002458b10 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x00000000029350e2 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x29350e2)
#15 0x0000000002935261 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2935261)
#16 0x0000000002936dd0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2936dd0)
#17 0x00000000007640c0 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#18 0x00000000006a9122 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x6a9122)
#19 0x00007fbfcbbef083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#20 0x000000000075c00e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x75c00e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```

PTRUE demo code:

```llvm
@G = global <8 x i1> zeroinitializer

define void @test() {
  %C = fcmp une <8 x double> <double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01>, <double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF>
 store <8 x i1> %C, ptr @G, align 1
  ret void
}
```

PTRUE demo backtrace:
```console
LLVM ERROR: Cannot select: 0x775b210: v8i1 = HexagonISD::PTRUE
In function: test
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=hexagon <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@test'
 #0 0x0000000003079ed8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3079ed8)
 #1 0x000000000307782c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fea21f91420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fea21a5400b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fea21a33859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x000000000069e37a llvm::RISCVISAInfo::updateImplication() (.cold) RISCVISAInfo.cpp:0:0
 #6 0x0000000002e5ead4 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e5ead4)
 #7 0x0000000002e641ad llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e641ad)
 #8 0x0000000002e5c137 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e5c137)
 #9 0x0000000002e68a65 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e68a65)
#10 0x0000000002e6b4b9 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e6b4b9)
#11 0x0000000002e6db86 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#12 0x000000000124ba66 llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x124ba66)
#13 0x0000000002458b10 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x00000000029350e2 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x29350e2)
#15 0x0000000002935261 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2935261)
#16 0x0000000002936dd0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2936dd0)
#17 0x00000000007640c0 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#18 0x00000000006a9122 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x6a9122)
#19 0x00007fea21a35083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#20 0x000000000075c00e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x75c00e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl1z26rW_jX4hrEHoe8LXzj-qmfad3fivj2zrzIIYZsTBDqAUqe__gxIdiTvtMlO04s9x5k2sUCs9bB4WCyeMTGG7yVjUxDfgHgxIo09KD1V5F7TUaHKx-lMPsLNLaSqZNAeiIVUSUu4NJDAHa1qyKWxuqGWK9m-8MiZKF13oZRgRMIHRq3SUO0gEQJa3TCotP-8I8IwSDUxB2agEHQC0AKgWfc7vpmrquaCabg81kJppuEYfl7NPm6XsGSVAvEC4OxgbW1AOAN4BfBqr8pCCTtReg_w6jvAq_hfJErX2ZcY4Pznlr_c_v_fMfyn_k-8fPhueob97x5CHzhnoj-vBLX_hHiouqYIrSEIF3AvVEEEBOE8xPAIeQDCJfzOtOKSW04E_85031bJdlwy-KB4CUGELDMW4Ow0_EDEzhkAOJ4BnEOQ3rTDoGuae49-EdXewucHuZfmrgmi44d0jpBruj7_Dz2HyxNnjFWaXXDT8cgNqa12BFyf3tXMelZ2ZE0XF9z_0X4pCL23mtAfbhqqpFGCta0fP379BJe3t3_cgnAG50RKZaFhglHrGtAxi8odzZB7eMh44Bn_gR3JXsnNduF8hJ371uBGwl0jfTZzY_x-ajF-XM62S2iaouLWJbdmDzWrlbbQKniRKbg9NMWEqgrgld_k7Z9xrd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