From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A265385DC0C; Tue, 28 Apr 2020 20:43:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A265385DC0C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588106603; bh=I65SXUMzzg6pBri8rck/plW735YxMOiE0e98tJ4Ovl8=; h=From:To:Subject:Date:From; b=vKtpffwNL6eRD9h5yAdLMOUJg1go+PyPGQfzAVCemqxk2lhzVYk15bjZnSTl6ha5T krmiqKO1QdHlERHv/UksSTsKWyCouZ61xduzdgbPTWbh2WwRsxn8Ti3BA0i1QbCwkq FmyFf7vcx8ECtVz5398FJ7WZkJAH2UtRXsEjmyKA= From: "cjashfor at linux dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/94833] New: vec_first_match_index does not function as described in its description Date: Tue, 28 Apr 2020 20:43:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 9.3.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cjashfor at linux dot ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 20:43:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94833 Bug ID: 94833 Summary: vec_first_match_index does not function as described in its description Product: gcc Version: 9.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: cjashfor at linux dot ibm.com CC: carll at gcc dot gnu.org Target Milestone: --- The description in the 64-bit ELF V2 ABI Specification 1.4 says this: Purpose: Performs a comparison of equality on each of the corresponding elements of = ARG1 and ARG2, and returns the first position of equality. Result value: Returns the element index of the position of the first character match. If = no match, returns the number of characters as an element count in the vector argument. Note that it doesn't make any mention of null or EOS characters. By the description, it ought to compare null characters for equality as well, but = it doesn't. It seems to terminate the comparison when it sees that there's a = null (0x00) in one of the two vector elements. Here's my test case: #include #include int main() { vector unsigned char v1 =3D { 0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; vector unsigned char vec_0s =3D vec_splats((unsigned char)0x0); int first_match_index =3D vec_first_match_index(v1, vec_0s); if (first_match_index !=3D 0) { printf("Failed: first_match_index should be 0 but it is %d\= n", first_match_index); } else { printf("Passed\n"); } return 0; } I compiled it with -mcpu=3Dpower9 -maltivec. When the test case is run, it= says this: Failed: first_match_index should be 0 but it is 16 I don't know whether the description is incomplete or the function isn't implemented correctly.=