From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by sourceware.org (Postfix) with ESMTPS id 4E93D385F02A for ; Sat, 21 Mar 2020 02:42:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4E93D385F02A Received: by mail-pf1-x443.google.com with SMTP id u68so4280521pfb.2 for ; Fri, 20 Mar 2020 19:42:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MxHe/9Q28KVpfRe6tH1crt30vxeONZzr4p54ekqcylk=; b=BjdxtY9AjPBezv7OifYI6g5uSXQc7D69qNOO1+2EbKUE6/Jlckxdl7mpSJNHQGDIZW TBjE/EwzcqQfiMH5WoWrLuO5XCzX9TtvpPZCzOGdxLuDzEkgaa6SXLZ42RuML4Jls/eu ELETl+9L7XeN4Ya8LfirnYid9NIpOynef6XqEzQqqgmvK7tOR2v3oaU5FTuClKzZTHfi 32qnQaY0+4lmCGNr+27AHC/stHaZAa+ei6JeknpQgkleu/j0TB9gTTr/7HjzVkA+aRAh s5fsPo0QwqUBa6czRgs6k6mXvzq3lgz2PoEc9srbYfAUO5pf476YDiMYlvMeCJiAHfF8 1LgQ== X-Gm-Message-State: ANhLgQ1FS/uEdpPQ9nDfFPtN4FjzAwZTzS+neYQaLPN/k57yF9PBN4EW 0cqm0QM1rBL60rKYNcKK1MmEy6RLvYw= X-Google-Smtp-Source: ADFU+vulLLUVhSzZgJNQTSZIoYqSeMwM8KR70yt6vbipTGR5ArgMr7YAvnpiZ3CU/0uZscerzd37GQ== X-Received: by 2002:a65:5846:: with SMTP id s6mr11511708pgr.179.1584758553744; Fri, 20 Mar 2020 19:42:33 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id c83sm6772831pfb.44.2020.03.20.19.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2020 19:42:32 -0700 (PDT) From: Richard Henderson To: gcc-patches@gcc.gnu.org Cc: richard.earnshaw@arm.com, richard.sandiford@arm.com, marcus.shawcroft@arm.com, kyrylo.tkachov@arm.com, Wilco.Dijkstra@arm.com Subject: [PATCH v2 0/9] aarch64: Implement TImode comparisons Date: Fri, 20 Mar 2020 19:42:22 -0700 Message-Id: <20200321024231.13778-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_2, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Mar 2020 02:42:37 -0000 This is attacking case 3 of PR 94174. Although I'm no longer using ccmp for most of the TImode comparisons. Thanks to Wilco Dijkstra for pulling off my blinders and reminding me that we can use subs+sbcs for (almost) all compares. The first 5 patches clean up or add patterns to support the expansion and not generate extraneous constant loads. The aarch64_expand_addsubti patch tidies up the existing TImode arithmetic expansions. EXAMPLE __subvti3 (context diff is easier to read): *** 12,27 **** 10: b7f800a3 tbnz x3, #63, 24 <__subvti3+0x24> ! 14: eb02003f cmp x1, x2 ! 18: 5400010c b.gt 38 <__subvti3+0x38> ! 1c: 54000140 b.eq 44 <__subvti3+0x44> // b.none 20: d65f03c0 ret ! 24: eb01005f cmp x2, x1 ! 28: 5400008c b.gt 38 <__subvti3+0x38> ! 2c: 54ffffa1 b.ne 20 <__subvti3+0x20> // b.any ! 30: eb00009f cmp x4, x0 ! 34: 54ffff69 b.ls 20 <__subvti3+0x20> // b.plast ! 38: a9bf7bfd stp x29, x30, [sp, #-16]! ! 3c: 910003fd mov x29, sp ! 40: 94000000 bl 0 ! 44: eb04001f cmp x0, x4 ! 48: 54ffff88 b.hi 38 <__subvti3+0x38> // b.pmore ! 4c: d65f03c0 ret --- 12,22 ---- 10: b7f800a3 tbnz x3, #63, 24 <__subvti3+0x24> ! 14: eb00009f cmp x4, x0 ! 18: fa01005f sbcs xzr, x2, x1 ! 1c: 540000ab b.lt 30 <__subvti3+0x30> // b.tstop 20: d65f03c0 ret ! 24: eb04001f cmp x0, x4 ! 28: fa02003f sbcs xzr, x1, x2 ! 2c: 54ffffaa b.ge 20 <__subvti3+0x20> // b.tcont ! 30: a9bf7bfd stp x29, x30, [sp, #-16]! ! 34: 910003fd mov x29, sp ! 38: 94000000 bl 0 EXAMPLE from the pr: void test3(__int128 a, uint64_t l) { if ((__int128_t)a - l <= 1) doit(); } *** 11,23 **** subs x0, x0, x2 sbc x1, x1, xzr ! cmp x1, 0 ! ble .L6 ! .L1: ret .p2align 2,,3 - .L6: - bne .L4 - cmp x0, 1 - bhi .L1 .L4: b doit --- 11,19 ---- subs x0, x0, x2 sbc x1, x1, xzr ! cmp x0, 2 ! sbcs xzr, x1, xzr ! blt .L4 ret .p2align 2,,3 .L4: b doit r~ Richard Henderson (9): aarch64: Accept 0 as first argument to compares aarch64: Accept zeros in add3_carryin aarch64: Add cmp_*_carryinC patterns aarch64: Add cmp_carryinC_m2 aarch64: Provide expander for sub3_compare1 aarch64: Introduce aarch64_expand_addsubti aarch64: Adjust result of aarch64_gen_compare_reg aarch64: Implement TImode comparisons aarch64: Implement absti2 gcc/config/aarch64/aarch64-protos.h | 10 +- gcc/config/aarch64/aarch64.c | 292 +++++++++------- gcc/config/aarch64/aarch64-simd.md | 18 +- gcc/config/aarch64/aarch64-speculation.cc | 5 +- gcc/config/aarch64/aarch64.md | 389 +++++++++++++--------- 5 files changed, 402 insertions(+), 312 deletions(-) -- 2.20.1