Hi! Like the other emit_*_via_libcall functions, emit_block_comp_via_libcall expects to be called with the MEM rtxes, not their addresses. E.g. emit_block_op_via_libcall does: dst_addr = copy_addr_to_reg (XEXP (dst, 0)); dst_addr = convert_memory_address (ptr_mode, dst_addr); dst_tree = make_tree (ptr_type_node, dst_addr); src_addr = copy_addr_to_reg (XEXP (src, 0)); src_addr = convert_memory_address (ptr_mode, src_addr); src_tree = make_tree (ptr_type_node, src_addr); prepare_cmp_insn doesn't call it with the MEMs, but their addresses, so it is either a wrong-code issue before (e.g. it was passing (plus (reg virtual...) (const_int N)) and (plus (reg virtual...) (const_int M)) on the following testcase, so it took (reg virtual...) in both cases as the address to compare, or with the recent additions to emit_block_op_via_libcall an ICE.
Unfortunately on the following testcase where it ICEs, the BLKmode comparison is there in dead code and so the return value doesn't matter, so all I can show is that it doesn't ICE anymore and that it calls memcmp with different addresses where previously it called them with the same addresses. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2019-02-05 Jakub Jelinek <ja...@redhat.com> PR target/89186 * optabs.c (prepare_cmp_insn): Pass x and y to emit_block_comp_via_libcall rather than XEXP (x, 0) and XEXP (y, 0). * g++.dg/ext/vector36.C: New test. --- gcc/optabs.c.jj 2019-01-22 10:11:00.960386744 +0100 +++ gcc/optabs.c 2019-02-04 12:40:45.881211716 +0100 @@ -3917,7 +3917,7 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx goto fail; /* Otherwise call a library function. */ - result = emit_block_comp_via_libcall (XEXP (x, 0), XEXP (y, 0), size); + result = emit_block_comp_via_libcall (x, y, size); x = result; y = const0_rtx; --- gcc/testsuite/g++.dg/ext/vector36.C.jj 2019-02-04 13:25:15.724616481 +0100 +++ gcc/testsuite/g++.dg/ext/vector36.C 2019-02-04 13:26:13.099655912 +0100 @@ -0,0 +1,6 @@ +// PR target/89186 +// { dg-do compile } +// { dg-options "-fnon-call-exceptions" } +// { dg-additional-options "-mno-sse" { target i?86-*-* x86_64-*-* } } + +#include "vector27.C" Jakub