From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id EDDDE385B835 for ; Sat, 18 Apr 2020 18:36:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EDDDE385B835 Received: by mail-lj1-x232.google.com with SMTP id u15so5543005ljd.3 for ; Sat, 18 Apr 2020 11:36:42 -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:references:in-reply-to:from:date :message-id:subject:to; bh=k2A1DkKz6kosdqCEeohYumBBZBHHeZIDOASB/1n0cR0=; b=RrtMEOAN+9wLeKdR9jJ/Hl3+EckcqlJ8zb0sTFVuYIQOA60t7i93lKt+RJ2DKqUJ4V UK6tlWrrSohEZ40YnkBWhXWVjBERLr5a86/j8F4KFJJt5xbC+1JSzoGmrthMZF57iZ6g E25Ve/9tKXY3UTshM6HawGF+2Ys5SABL0mV5/BI0vF+khjAiiJfwSMZ6/ktkSXHpb9/9 a17lecuTCAg+JjQU5k63+vGmYlvRrpOV6IseSYjjp/HvhoI5KcCBX5ATEuwDcXK5n7+r ysXcBZptK3MykwLixTCRJuHXfjdBoi9RGr2SY71qJHtlvlzHXz0OxfTiMgz1/+NtLX8G 7Y1g== X-Gm-Message-State: AGi0PubF/DsbCyegULocO0YBjWNbemLTEAMo7WKJ97g3WFl+QHzNqmTo t0YuEA4jRurpt6XhuhDQxOA4qpOeNJZcesk3KxeVssgeXrY= X-Google-Smtp-Source: APiQypIkn1o/uYJ8VzyMRQ3euG2v1wAEyNB92stt9NqrQ0bvjZ0kkweWCcgyBjcT38D4DkjuRQi35yJeI1NxfvUHwmA= X-Received: by 2002:a2e:9907:: with SMTP id v7mr5043071lji.199.1587235001119; Sat, 18 Apr 2020 11:36:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: William Tambe Date: Sat, 18 Apr 2020 14:36:29 -0400 Message-ID: Subject: Re: prevent zero-extension when using a memory load instruction To: gcc-help Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2020 18:36:45 -0000 On Sat, Apr 18, 2020 at 11:32 AM Marc Glisse wrote: > > On Sat, 18 Apr 2020, William Tambe via Gcc-help wrote: > > > In the machine description file, is there a way to tell GCC that a > > memory load instruction already zero-extend such that it does not try > > to apply zero-extension ? > > I would look at it the other way around: you can tell GCC what asm to > generate for a zero_extend with a memory operand. Or did you have a Thanks; tried above, but GCC still prefer a memory load followed by zero-extension. The example code used is as follow: unsigned char var; int main() { return var; } Also tried x86 and ARM GCC port to see what they produce, and find that only x86 will not generate a zero-extension when -Os is used. The version of GCC used is 9.2.0. Any other suggestions on how to tell GCC not to zero-extend the result of a memory load ? > specific example in mind? > > -- > Marc Glisse