From patchwork Sun May 23 20:17:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1482514 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Blzt1OwO; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FpBVY4fGJz9sRf for ; Mon, 24 May 2021 06:18:12 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7D56B3857433; Sun, 23 May 2021 20:18:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D56B3857433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1621801089; bh=OZtg2EEwp2Y8Vw4Ttl5bI3KzG4xqmBWpg92mcSUOh5Q=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Blzt1OwOj8fUeNhwlrZY3liyIlVWTff1Wz03VlmVjNumAGZuy7MZWja2nj0AC/XJ7 H6pVSU86IOhuAfWpW9eKWFYrSM2Yr25Azm05D7N0iH4jKEIYX2dZ4MQaRcveH5LLta U5GaTc2qaFCjEP5WJrrHVSeijDzUGCX3s+rrKFE0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by sourceware.org (Postfix) with ESMTPS id 50395385782C for ; Sun, 23 May 2021 20:18:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 50395385782C Received: by mail-qk1-x731.google.com with SMTP id h20so9650318qko.11 for ; Sun, 23 May 2021 13:18:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=OZtg2EEwp2Y8Vw4Ttl5bI3KzG4xqmBWpg92mcSUOh5Q=; b=OUIsDOeiRT7uth9fi+N/V7Zg5SxM3ZL2bLr4K7GeVrDxChAfawvmVxmEQ6SsTPeeXr IbkEPyaBy3mLOhR638XMLWXZ0nb0JkRToOFLEQEdQZqapQxTbMTbn3VHWeTkQI8yeyFI b6B9xiIZNRO8AOu/AfA2MeHnTq7Ly/FIoUnTGXDQJiIK4TByGgybXbTAaCJxngs5Q9Xd hIvnq5FmAIHrwANgvXmvpaX/sNg8ILeeNehcQm/dsaKfdaSp5urvZ+oET7bWwnEreRIt WOk4OxjfoZ3/YwTmAiNONkLUx9lFJC1If8NDuYvoq16mlQ4Wqv+NO/yn7zh+ebtGbKrP 8uXw== X-Gm-Message-State: AOAM533F1DF5aezAf6G2aI8YhBHbXyIVwYpzkiLjOOv8v/VFjRvuFAkc d5I7usuhJbGVB508luSaNem9jSd37tPr3UyUYy5KmZeN9MpcEw== X-Google-Smtp-Source: ABdhPJwM1am5rZ5GC4iFy6/6tlQdjzu3aQMYtsMoxYOgAS3t5no/6WNAabHAwrLarbz1nlZe+1SJ/6xTGZCRaHG0cYE= X-Received: by 2002:a05:620a:2456:: with SMTP id h22mr24483077qkn.292.1621801085710; Sun, 23 May 2021 13:18:05 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 23 May 2021 22:17:54 +0200 Message-ID: Subject: [PATCH] i386: Add push insns for 4-byte vectors [PR100722] To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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-Patchwork-Original-From: Uros Bizjak via Gcc-patches From: Uros Bizjak Reply-To: Uros Bizjak Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" 2021-05-23 Uroš Bizjak gcc/ PR target/100722 * config/i386/mmx.md (*push2_rex64): New instruction pattern. (*push2): Ditto. (push splitter for SSE registers): New splitter. gcc/testsuite/ PR target/100722 * gcc.target/i386/pr100722.c: New test. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Pushed to master. Uros. diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 4c42e6d93dc..453e8ea406d 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -302,6 +302,39 @@ (define_insn "*mov_internal" ] (symbol_ref "true")))]) +;; For TARGET_64BIT we always round up to 8 bytes. +(define_insn "*push2_rex64" + [(set (match_operand:VI_32 0 "push_operand" "=X,X") + (match_operand:VI_32 1 "nonmemory_no_elim_operand" "rC,*v"))] + "TARGET_SSE2 && TARGET_64BIT" + "@ + push{q}\t%q1 + #" + [(set_attr "type" "push,multi") + (set_attr "mode" "DI")]) + +(define_insn "*push2" + [(set (match_operand:VI_32 0 "push_operand" "=<,<") + (match_operand:VI_32 1 "general_no_elim_operand" "rC*m,*v"))] + "TARGET_SSE2 && !TARGET_64BIT" + "@ + push{l}\t%1 + #" + [(set_attr "type" "push,multi") + (set_attr "mode" "SI")]) + +(define_split + [(set (match_operand:VI_32 0 "push_operand") + (match_operand:VI_32 1 "sse_reg_operand"))] + "TARGET_SSE2 && reload_completed" + [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2))) + (set (match_dup 0) (match_dup 1))] +{ + operands[2] = GEN_INT (-PUSH_ROUNDING (GET_MODE_SIZE (mode))); + /* Preserve memory attributes. */ + operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx); +}) + (define_expand "movmisalign" [(set (match_operand:VI_32 0 "nonimmediate_operand") (match_operand:VI_32 1 "nonimmediate_operand"))] diff --git a/gcc/testsuite/gcc.target/i386/pr100722.c b/gcc/testsuite/gcc.target/i386/pr100722.c new file mode 100644 index 00000000000..f784039f275 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100722.c @@ -0,0 +1,17 @@ +/* PR target/100722 */ +/* { dg-do compile } */ +/* { dg-options "-O -msse2" } */ + +typedef char int8x4_t __attribute__((vector_size(4))); + +void stack_callee (int8x4_t, int8x4_t, int8x4_t, int8x4_t, + int8x4_t, int8x4_t, int8x4_t); + +int8x4_t stack_caller_x1; + +void stack_caller (void) +{ + stack_callee (stack_caller_x1, stack_caller_x1, stack_caller_x1, + stack_caller_x1, stack_caller_x1, stack_caller_x1, + stack_caller_x1); +}