<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Crash when using saturating intrinsics for vectors of i128 on PowerPC"
   href="https://bugs.llvm.org/show_bug.cgi?id=50084">50084</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash when using saturating intrinsics for vectors of i128 on PowerPC
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: PowerPC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>caleb.zulawski@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Example: <a href="https://gcc.godbolt.org/z/jMqj91oza">https://gcc.godbolt.org/z/jMqj91oza</a>


IR:

declare <4 x i128> @llvm.sadd.sat.v4i128(<4 x i128> %a, <4 x i128> %b);

define <4 x i128> @sadd(<4 x i128> %a, <4 x i128> %b) local_unnamed_addr {
    %c = call <4 x i128> @llvm.sadd.sat.v4i128(<4 x i128> %a, <4 x i128> %b)
    ret <4 x i128> %c
}


Crash output:

LLVM ERROR: Cannot select: 0x56244a18e1d8: v1i128 = vselect 0x56244a18e8c0,
0x56244a18e170, 0x56244a18e240
  0x56244a18e8c0: v1i128 = bitcast 0x56244a18e858
    0x56244a18e858: v4i32 = xor 0x56244a18ea60, 0x56244a18e2a8
      0x56244a18ea60: v4i32 = bitcast 0x56244a18ee08
        0x56244a18ee08: v2i64 = BUILD_VECTOR 0x56244a1901f8, 0x56244a1901f8
          0x56244a1901f8: i64 = sra 0x56244a18ecd0, Constant:i32<63>
            0x56244a18ecd0: i64 = extract_vector_elt 0x56244a18ec00,
Constant:i64<1>
              0x56244a18ec00: v2i64 = bitcast 0x56244a183118
                0x56244a183118: v1i128,ch = CopyFromReg 0x56244a1832b8:1,
Register:v1i128 %15
                  0x56244a1831e8: v1i128 = Register %15
              0x56244a186308: i64 = Constant<1>
            0x56244a1863d8: i32 = Constant<63>
          0x56244a1901f8: i64 = sra 0x56244a18ecd0, Constant:i32<63>
            0x56244a18ecd0: i64 = extract_vector_elt 0x56244a18ec00,
Constant:i64<1>
              0x56244a18ec00: v2i64 = bitcast 0x56244a183118
                0x56244a183118: v1i128,ch = CopyFromReg 0x56244a1832b8:1,
Register:v1i128 %15
                  0x56244a1831e8: v1i128 = Register %15
              0x56244a186308: i64 = Constant<1>
            0x56244a1863d8: i32 = Constant<63>
      0x56244a18e2a8: v4i32 = bitcast 0x56244a18e378
        0x56244a18e378: v2i64 = BUILD_VECTOR 0x56244a186920, 0x56244a186920
          0x56244a186920: i64 = select_cc 0x56244a18e310, Constant:i32<0>,
Constant:i64<-1>, Constant:i64<0>, setne:ch
            0x56244a18e310: i32 = select_cc 0x56244a186e68, 0x56244a1862a0,
0x56244a18ada0, 0x56244a18af40, seteq:ch
              0x56244a186e68: i64 = extract_vector_elt 0x56244a186d98,
Constant:i64<1>
                0x56244a186d98: v2i64 = bitcast 0x56244a18e240
                  0x56244a18e240: v1i128 = add 0x56244a183a70, 0x56244a183118


                0x56244a186308: i64 = Constant<1>
              0x56244a1862a0: i64 = extract_vector_elt 0x56244a186370,
Constant:i64<1>
                0x56244a186370: v2i64 = bitcast 0x56244a183a70
                  0x56244a183a70: v1i128,ch = CopyFromReg 0x56244a183ce0:1,
Register:v1i128 %11

                0x56244a186308: i64 = Constant<1>
              0x56244a18ada0: i32 = setcc 0x56244a186e00, 0x56244a186238,
setult:ch
                0x56244a186e00: i64 = extract_vector_elt 0x56244a186d98,
Constant:i64<0>
                  0x56244a186d98: v2i64 = bitcast 0x56244a18e240

                  0x56244a183048: i64 = Constant<0>
                0x56244a186238: i64 = extract_vector_elt 0x56244a186370,
Constant:i64<0>
                  0x56244a186370: v2i64 = bitcast 0x56244a183a70

                  0x56244a183048: i64 = Constant<0>
              0x56244a18af40: i32 = setcc 0x56244a186e68, 0x56244a1862a0,
setlt:ch
                0x56244a186e68: i64 = extract_vector_elt 0x56244a186d98,
Constant:i64<1>
                  0x56244a186d98: v2i64 = bitcast 0x56244a18e240

                  0x56244a186308: i64 = Constant<1>
                0x56244a1862a0: i64 = extract_vector_elt 0x56244a186370,
Constant:i64<1>
                  0x56244a186370: v2i64 = bitcast 0x56244a183a70

                  0x56244a186308: i64 = Constant<1>
            0x56244a18bee8: i32 = Constant<0>
            0x56244a183d48: i64 = Constant<-1>
            0x56244a183048: i64 = Constant<0>
          0x56244a186920: i64 = select_cc 0x56244a18e310, Constant:i32<0>,
Constant:i64<-1>, Constant:i64<0>, setne:ch
            0x56244a18e310: i32 = select_cc 0x56244a186e68, 0x56244a1862a0,
0x56244a18ada0, 0x56244a18af40, seteq:ch
              0x56244a186e68: i64 = extract_vector_elt 0x56244a186d98,
Constant:i64<1>
                0x56244a186d98: v2i64 = bitcast 0x56244a18e240
                  0x56244a18e240: v1i128 = add 0x56244a183a70, 0x56244a183118


                0x56244a186308: i64 = Constant<1>
              0x56244a1862a0: i64 = extract_vector_elt 0x56244a186370,
Constant:i64<1>
                0x56244a186370: v2i64 = bitcast 0x56244a183a70
                  0x56244a183a70: v1i128,ch = CopyFromReg 0x56244a183ce0:1,
Register:v1i128 %11

                0x56244a186308: i64 = Constant<1>
              0x56244a18ada0: i32 = setcc 0x56244a186e00, 0x56244a186238,
setult:ch
                0x56244a186e00: i64 = extract_vector_elt 0x56244a186d98,
Constant:i64<0>
                  0x56244a186d98: v2i64 = bitcast 0x56244a18e240

                  0x56244a183048: i64 = Constant<0>
                0x56244a186238: i64 = extract_vector_elt 0x56244a186370,
Constant:i64<0>
                  0x56244a186370: v2i64 = bitcast 0x56244a183a70

                  0x56244a183048: i64 = Constant<0>
              0x56244a18af40: i32 = setcc 0x56244a186e68, 0x56244a1862a0,
setlt:ch
                0x56244a186e68: i64 = extract_vector_elt 0x56244a186d98,
Constant:i64<1>
                  0x56244a186d98: v2i64 = bitcast 0x56244a18e240

                  0x56244a186308: i64 = Constant<1>
                0x56244a1862a0: i64 = extract_vector_elt 0x56244a186370,
Constant:i64<1>
                  0x56244a186370: v2i64 = bitcast 0x56244a183a70

                  0x56244a186308: i64 = Constant<1>
            0x56244a18bee8: i32 = Constant<0>
            0x56244a183d48: i64 = Constant<-1>
            0x56244a183048: i64 = Constant<0>
  0x56244a18e170: v1i128 = vselect 0x56244a18eb98, 0x56244a18b938,
0x56244a18aa60
    0x56244a18eb98: v1i128 = bitcast 0x56244a18eb30
      0x56244a18eb30: v2i64 = BUILD_VECTOR 0x56244a18ed38, 0x56244a18ed38
        0x56244a18ed38: i64 = sra 0x56244a186e68, Constant:i32<63>
          0x56244a186e68: i64 = extract_vector_elt 0x56244a186d98,
Constant:i64<1>
            0x56244a186d98: v2i64 = bitcast 0x56244a18e240
              0x56244a18e240: v1i128 = add 0x56244a183a70, 0x56244a183118
                0x56244a183a70: v1i128,ch = CopyFromReg 0x56244a183ce0:1,
Register:v1i128 %11
                  0x56244a183c10: v1i128 = Register %11
                0x56244a183118: v1i128,ch = CopyFromReg 0x56244a1832b8:1,
Register:v1i128 %15
                  0x56244a1831e8: v1i128 = Register %15
            0x56244a186308: i64 = Constant<1>
          0x56244a1863d8: i32 = Constant<63>
        0x56244a18ed38: i64 = sra 0x56244a186e68, Constant:i32<63>
          0x56244a186e68: i64 = extract_vector_elt 0x56244a186d98,
Constant:i64<1>
            0x56244a186d98: v2i64 = bitcast 0x56244a18e240
              0x56244a18e240: v1i128 = add 0x56244a183a70, 0x56244a183118
                0x56244a183a70: v1i128,ch = CopyFromReg 0x56244a183ce0:1,
Register:v1i128 %11
                  0x56244a183c10: v1i128 = Register %11
                0x56244a183118: v1i128,ch = CopyFromReg 0x56244a1832b8:1,
Register:v1i128 %15
                  0x56244a1831e8: v1i128 = Register %15
            0x56244a186308: i64 = Constant<1>
          0x56244a1863d8: i32 = Constant<63>
    0x56244a18b938: v1i128 = bitcast 0x56244a18b420
      0x56244a18b420: v2f64,ch = PPCISD::XXSWAPD 0x56244a18b8d0:1,
0x56244a18b8d0
        0x56244a18b8d0: v2f64,ch = PPCISD::LXVD2X<(load 16 from constant-pool)>
0x56244a13aae8, 0x56244a18aac8
          0x56244a18aac8: i64,ch = PPCISD::TOC_ENTRY<(load 8 from got)>
TargetConstantPool:i64<<2 x i64> <i64 -1, i64 9223372036854775807>> 0,
Register:i64 $x2
            0x56244a18ba08: i64 = TargetConstantPool<<2 x i64> <i64 -1, i64
9223372036854775807>> 0
            0x56244a183938: i64 = Register $x2
    0x56244a18aa60: v1i128 = bitcast 0x56244a18b488
      0x56244a18b488: v2f64,ch = PPCISD::XXSWAPD 0x56244a1835f8:1,
0x56244a1835f8
        0x56244a1835f8: v2f64,ch = PPCISD::LXVD2X<(load 16 from constant-pool)>
0x56244a13aae8, 0x56244a190260
          0x56244a190260: i64,ch = PPCISD::TOC_ENTRY<(load 8 from got)>
TargetConstantPool:i64<<2 x i64> <i64 0, i64 -9223372036854775808>> 0,
Register:i64 $x2
            0x56244a190ae8: i64 = TargetConstantPool<<2 x i64> <i64 0, i64
-9223372036854775808>> 0
            0x56244a183938: i64 = Register $x2
  0x56244a18e240: v1i128 = add 0x56244a183a70, 0x56244a183118
    0x56244a183a70: v1i128,ch = CopyFromReg 0x56244a183ce0:1, Register:v1i128
%11
      0x56244a183c10: v1i128 = Register %11
    0x56244a183118: v1i128,ch = CopyFromReg 0x56244a1832b8:1, Register:v1i128
%15
      0x56244a1831e8: v1i128 = Register %15
In function: sadd
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o
/app/output.s -O0 -march=ppc64le <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on
function '@sadd'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH
or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x2c)[0x56244548ed2c]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm3sys17RunSignalHandlersEv+0x34)[0x56244548ccb4]
/opt/compiler-explorer/clang-trunk/bin/llc(+0x28d3e23)[0x56244548ce23]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f477290a3c0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7f47723da18b]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f47723b9859]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm18report_fatal_errorERKNS_5TwineEb+0x96)[0x5624453fb656]
/opt/compiler-explorer/clang-trunk/bin/llc(+0x28427be)[0x5624453fb7be]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm16SelectionDAGISel15CannotYetSelectEPNS_6SDNodeE+0x234)[0x5624452d6ce4]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm16SelectionDAGISel16SelectCodeCommonEPNS_6SDNodeEPKhj+0x21da)[0x5624452d9e1a]
/opt/compiler-explorer/clang-trunk/bin/llc(+0x1313ca7)[0x562443eccca7]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm16SelectionDAGISel22DoInstructionSelectionEv+0x254)[0x5624452d5834]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm16SelectionDAGISel17CodeGenAndEmitDAGEv+0x2a6)[0x5624452dd116]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE+0x1d44)[0x5624452e0664]
/opt/compiler-explorer/clang-trunk/bin/llc(+0x2729682)[0x5624452e2682]
/opt/compiler-explorer/clang-trunk/bin/llc(+0x1318936)[0x562443ed1936]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0x378)[0x562444990cd8]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x427)[0x562444d82df7]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x31)[0x562444d83511]
/opt/compiler-explorer/clang-trunk/bin/llc(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x53f)[0x562444d8204f]
/opt/compiler-explorer/clang-trunk/bin/llc(+0x88ec11)[0x562443447c11]
/opt/compiler-explorer/clang-trunk/bin/llc(main+0x3a6)[0x5624433769c6]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f47723bb0b3]
/opt/compiler-explorer/clang-trunk/bin/llc(_start+0x2a)[0x56244343f9aa]
Compiler returned: 139</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>