From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 6C4683858D3C for ; Thu, 1 Sep 2022 17:31:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6C4683858D3C Received: by mail-ot1-x329.google.com with SMTP id 92-20020a9d0be5000000b0063946111607so12848325oth.10 for ; Thu, 01 Sep 2022 10:31:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date; bh=lI85ktGjOMY8JnFbnSNe8cPGu1Ge0mumA2MLArHcM7I=; b=kzJIUcqz2QXgwvxIbww1UuSLHHocNhIlUE0sZTaYaGgroXfE4kCE5vJCJRs4kF225L unAkqFXolM1KW3lEMtFlAqyPIsVg17IFw69mhhOzus0aaze1QK5AuSutT6k/drbpCYh3 fbkYpsALyqrGpBvjN2vDmBBy65+t8CJ0EGrSm8ODCwMhvzEP7JH3b29fcpRkNfxXpOd0 BBSRR+yqEmHsaU2iR78h1X8MYPLhaeMtiF91nz5rWr3yvbm/Lp+jnBPKaWp2+eSlMhVu LSZfpojBVUrRPsIUcOCMb/GVCpXSS/A+kWnYIIZHUGSMu+VkbKqAJ9YkyoyajWqqVdze PZIg== X-Gm-Message-State: ACgBeo2UjwsNoRN/lwm7wzb1Oo97dtoa3bpc2/UlLNlYxsweorRcjmsg 7UL14zdxb5CrRAWGK0vPd8aE2Q== X-Google-Smtp-Source: AA6agR6oQS3Ne2TXr763Wq96dvtEuLVlJsc7NBHpreWcCDHmqKTsoRHjFa7aPsUFkGGTDFzPBAkkjg== X-Received: by 2002:a9d:629:0:b0:638:de32:a511 with SMTP id 38-20020a9d0629000000b00638de32a511mr12710333otn.376.1662053460255; Thu, 01 Sep 2022 10:31:00 -0700 (PDT) Received: from [192.168.15.31] ([187.34.212.254]) by smtp.gmail.com with ESMTPSA id c4-20020a9d6844000000b00636f7059b27sm10486358oto.5.2022.09.01.10.30.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Sep 2022 10:30:59 -0700 (PDT) Message-ID: <6fbeb720-c4f6-501e-cefc-5eac6c7b5594@linaro.org> Date: Thu, 1 Sep 2022 14:29:42 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] math: x86: Use prefix for FP_INIT_ROUNDMODE To: "H.J. Lu" Cc: libc-alpha@sourceware.org References: <20220901130253.1684344-1-adhemerval.zanella@linaro.org> Content-Language: en-US From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2022 17:31:02 -0000 On 01/09/22 13:49, H.J. Lu wrote: > On Thu, Sep 1, 2022 at 9:42 AM H.J. Lu wrote: >> >> On Thu, Sep 1, 2022 at 6:03 AM Adhemerval Zanella via Libc-alpha >> wrote: >>> >>> Not all compilers support the inline asm prefix '%v' to emit the avx >>> instruction if AVX is enable. Use a prefix instead. >>> >>> Checked on x86_64-linux-gnu and i686-linux-gnu. >>> --- >>> sysdeps/x86/fpu/sfp-machine.h | 8 +++++++- >>> 1 file changed, 7 insertions(+), 1 deletion(-) >>> >>> diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h >>> index 5892f4f5fe..006eebe257 100644 >>> --- a/sysdeps/x86/fpu/sfp-machine.h >>> +++ b/sysdeps/x86/fpu/sfp-machine.h >>> @@ -39,9 +39,15 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); >>> >>> # define FP_RND_MASK 0x6000 >>> >>> +# ifdef __AVX__ >>> +# define AVX_INSN_PREFIX "v" >>> +# else >>> +# define AVX_INSN_PREFIX "" >>> +# endif >>> + >>> # define FP_INIT_ROUNDMODE \ >>> do { \ >>> - __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw)); \ >>> + __asm__ __volatile__ (AVX_INSN_PREFIX "stmxcsr\t%0" : "=m" (_fcw)); \ >>> } while (0) >>> #else >>> # define _FP_W_TYPE_SIZE 32 >>> -- >>> 2.34.1 >>> >> >> Should we use __builtin_ia32_stmxcsr instead? >> > > __builtin_ia32_stmxcsr requires extra instructions. > I don't have a strong option, although in theory builtins would play nice in general code generation.