From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2AuUKIJXEGcrDAAA62LTzQ:P1 (envelope-from ) for ; Thu, 17 Oct 2024 02:17:06 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 2AuUKIJXEGcrDAAA62LTzQ (envelope-from ) for ; Thu, 17 Oct 2024 02:17:06 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=okRjlO5l; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=Ep+POxW5; dmarc=pass (policy=none) header.from=maniero.me; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1729124226; a=rsa-sha256; cv=pass; b=rXxzyesmPkJcJxhvMaV8vWg4VNPP9fneOue+pyUeBqQnX5YpzOgBbOhplQ3hKdxP3+fa8x Q9aEpbPKznOYsImu2SntTDDDb6BgFUOqmT+GqR64dgCMcr34vwoV0Qn0BQYGvkpURqNBex hHad/iknAz4QU4tX4XUckWXhK6TAjiEJKy6t7YhfJ023fixK3NfJaXSZoRHp4GSJXxXvWz DKUvCwH+RLLypaJ6/Kp8Y0IUIWNY4i06zTM9J4zLNGVUzX2T2EhjAxNMcvxgOpQ5TAmz0V Y/vrb9NK8O7k4Yo5DaPMTjdKAsoyk9kdeS2md0rzpicwL2hTR1ExFFf2XbLfDw== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=okRjlO5l; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=Ep+POxW5; dmarc=pass (policy=none) header.from=maniero.me; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1729124226; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=453sA31IyTOtFrETT7W2lvNPYeBki8ercCWKE4xTQPc=; b=HyWTgPSavIBaf9+mLdHk6KvTy6DIqEr1uw/CYCFveqqnQ5Jmjk1gd9F9ueLlHLZats8ByT o9iEJ1PMqVPD6M8jiGDrSv1L73YoKAAQV1oxz2PQ7norzNU9MWweclBC/wKW4qN5mlw0qi vQgRJZB8wATZV+tTFxv5+gkYl8e8aNSla4DJBkSnJXqYhV9QL8oFkdEP0TwGckDONSaI5L QAF1JtmkVrdC1Bp34zd5B6kVzii/SCV0+6aeklV+YuFef5+tZ4r3HCC7dwvPaAXl0K8yT/ G0dN1RBBHQ4HVCKTVeTg3vd2lOV1+wJMaZWgHrcOCksF/37bYEr/4EGgBop1HA== Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 586F862828 for ; Thu, 17 Oct 2024 02:17:05 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=IqzEfMeAg7WB0ibGp8fPlJKawWx6zbFhsq89J5l46t0=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:Date:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1729124224; v=1; b=okRjlO5l7GYxfmCMCNhNGil8j7k3CO1iitpuTpAMKTyvTp2dfZncvbT16saDhXvh77G22Rds QKIhmbDb+z1eRSrlxG6fzNk/rYFlXGhWFxQdkRNEts1kUuM2XL61u88uY6hk7r3PUY20EqH3mD3 xv4zToz3ZYw2d9gKbTZDE9Qnae8f+L8Nk0uhLmAtJXoXNENTlc+YLg7hLXS1saX4AVKv8gLiED7 co7CH4RV0BKyvSEOeHALRALXQ05DNPzecT2hryDFaIXmW612atBs5q0TQM5e3iZRzDC18yt6tCL gNdkYHF9bj+mkA0uP2hvJxBOBeNJtQ8ZXKhQb+DVg8vVw== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id BCC94202C7 for ; Thu, 17 Oct 2024 00:17:04 +0000 (UTC) Received: from tiger.tulip.relay.mailchannels.net (tiger.tulip.relay.mailchannels.net [23.83.218.248]) by mail-a.sr.ht (Postfix) with ESMTPS id 42E4220288 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 17 Oct 2024 00:17:03 +0000 (UTC) X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 68F1DC6B61 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 17 Oct 2024 00:17:01 +0000 (UTC) Received: from uk-fast-smtpout10.hostinger.io (100-101-182-205.trex-nlb.outbound.svc.cluster.local [100.101.182.205]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 8B4BAC6BD3 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 17 Oct 2024 00:17:00 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1729124220; a=rsa-sha256; cv=none; b=2kHAKuaOZT8CoX5GOYieMiqJvj6S8BR7kK37dxlv8NO6VwjVMcQlZr/MIA55un9Z5Rg1Mb zX+xWcQ1rQmf6dYb0GSAFOMTGDs+VbFC7nqVGYH6/xboRLDt6JTTGatC0pZb2pqqO7CU7H WRXt63D6LzOmmQec7mBbPYFh3jNbxVe3Y8NDLf0uF4QA3IM6Ydsk9JAMZtTiA9t19IinTN 5g9b8f5LFHImJBK72OOSwSObRWXviFrs7eiB7Yj+fINdlnq2Bw1x15CRZzQ7s6qTD/xRHb SnvrIhjJyo5+MXZWjYYGzIgIQCweKYkt42N9par2K/YCT81/cYey9PxqbMRaPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1729124220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=453sA31IyTOtFrETT7W2lvNPYeBki8ercCWKE4xTQPc=; b=RSHT3fJGVrUOaoSC2HlNvOJJEkpz1CPLrar1sTpzCahwIYc8rxIW3C7p4peEaGaOToxDuf 4aqSJY6WCTnVjPXO+Xd3UoRwvek7AkKELTkD6QlKzdazb0Ca8vWI9Xp3J9y6KSF3BRyw7D aWoe+j5c2Ajfz81wMwxELW0rNVhSfLoX3RX5A/pylJyRVXH2as3HBt9t7hklxaWM4ZZfko 1v1Hm/74+n9z8DK3Xman7jwVDuHfgAEWQlPKyjv5ukVHoMgj5EHEHKmw47Jc2pLBtVsx5r ByJOyY+8fhikon2LkMB1QClM+jrHeJh3gEMwqAYU/T3HfCfyTv7xGXDELheZIA== ARC-Authentication-Results: i=1; rspamd-6bcbdd57f8-wdzsb; auth=pass smtp.auth=hostingeremail smtp.mailfrom=carlos@maniero.me X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|carlos@maniero.me X-MailChannels-Auth-Id: hostingeremail X-Juvenile-Celery: 462276de6c32dbae_1729124221054_2275650030 X-MC-Loop-Signature: 1729124221054:2177439036 X-MC-Ingress-Time: 1729124221054 Received: from uk-fast-smtpout10.hostinger.io (uk-fast-smtpout10.hostinger.io [145.14.155.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.101.182.205 (trex/7.0.2); Thu, 17 Oct 2024 00:17:01 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1729124218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=453sA31IyTOtFrETT7W2lvNPYeBki8ercCWKE4xTQPc=; b=Ep+POxW51LsPXkkzTHqHrRJ722bkCkkO38V+xZAUzXxHGZkTh6UNYPiQlQlszi8JzPW/kr w1eGreusFJlK92tx0WskQYoyovijhujLDCCUlVAXJ967IeM1S5XtE0ywjzv983QZRS7Rgd Ys4EQJXu7Pghhi9Ry5hNVFBVRQnRshn0l04hExi+PfBSaxLr41at/QMp6PQbyP4Af7vBUK YAOjrYGWCNwfe53Xt/wydoQ5Cjgtu8EQIuDTibrTsF8PiOJfoUt06MG5ptPlrdYAyk8/D9 vdlA9w4Gw7nia6Z+XA4TroCuan3AF7s3Eo05fkmwBo3CSRkxTMC/Sz2XwA7waQ== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v1] codegen: x64: use the low bit register for 8 bits ops Message-ID: <20241017001654.271323-1-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Thu, 17 Oct 2024 00:16:57 +0000 (UTC) X-CM-Envelope: MS4xfF/5ZxwPpVQxauoOStjAGXN2huKC9N1u5FYrKVRxwCLu9/WR8yGnx/1h8LLUtJQeVPx4uhqIc34F1htGAsw5w/CaB0Lnf6T3j5DXO+dIu1AM/D/xUiOJ 7sPaCjvAv0cBGXpSD8VAu3GQjiLMkPenE3ndU64EuS/WfOuTHHgB6/SIg3EBJKZUC6aoZsMAhPgtpREV1zvvvC4qvN+mfLco5LNLYkwiIKgN19072ZxiLarJ X-CM-Analysis: v=2.4 cv=TcnEtgQh c=1 sm=1 tr=0 ts=6710577a a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=HHoOWidlmuDC7hLF8s4A:9 a=BXDaF_L80NY05PYiAFlV:22 X-AuthUser: carlos@maniero.me X-Sourcehut-Patchset-Status: PROPOSED List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Flow: FLOW_IN X-Migadu-Country: NL X-Migadu-Spam-Score: -0.77 X-Spam-Score: -0.77 X-Migadu-Queue-Id: 586F862828 X-Migadu-Scanner: mx12.migadu.com X-TUID: pxc8JwR2bbsa There was some registers that was using the high bit instead. Signed-off-by: Carlos Maniero --- src/codegen_x86_64.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/codegen_x86_64.c b/src/codegen_x86_64.c index 1951365..c4cef3c 100644 --- a/src/codegen_x86_64.c +++ b/src/codegen_x86_64.c @@ -967,7 +967,7 @@ get_reg_for(x86_64_register_type_t type, size_t bytes) switch (type) { case REG_ACCUMULATOR: { if (bytes <= 1) { - return "%ah"; + return "%al"; } else if (bytes <= 2) { return "%ax"; } else if (bytes <= 4) { @@ -977,7 +977,7 @@ get_reg_for(x86_64_register_type_t type, size_t bytes) } case REG_BASE: { if (bytes <= 1) { - return "%bh"; + return "%bl"; } else if (bytes <= 2) { return "%bx"; } else if (bytes <= 4) { @@ -987,7 +987,7 @@ get_reg_for(x86_64_register_type_t type, size_t bytes) } case REG_COUNTER: { if (bytes <= 1) { - return "%ch"; + return "%cl"; } else if (bytes <= 2) { return "%cx"; } else if (bytes <= 4) { @@ -997,7 +997,7 @@ get_reg_for(x86_64_register_type_t type, size_t bytes) } case REG_DATA: { if (bytes <= 1) { - return "%dh"; + return "%dl"; } else if (bytes <= 2) { return "%dx"; } else if (bytes <= 4) { base-commit: c01fa7cf444bdd2cc9d6befff462285783263413 -- 2.46.1