220 35513 <9a7a898c-9e14-532f-fc4a-11d0aa5a1bf7@gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Andrey Semashev <andrey.semashev@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Rotational shift operator
Date: Sat, 25 Nov 2017 15:08:07 +0300
Lines: 43
Approved: news@gmane.org
Message-ID: <9a7a898c-9e14-532f-fc4a-11d0aa5a1bf7@gmail.com>
References: <69593098-e2cc-487e-bd14-9001b27aa7c1@isocpp.org>
 <1527647.07Qi8WvUZa@tjmaciei-mobl1>
 <f3dafdfb-df6a-ac57-fdff-fba300c734d9@gmail.com>
 <3031585.uCQqKE2Qzv@tjmaciei-mobl1>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
X-Trace: blaine.gmane.org 1511611690 22238 195.159.176.226 (25 Nov 2017 12:08:10 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 25 Nov 2017 12:08:10 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.4.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCXY5TXHWYJRBKN24XIAKGQEAIDT2LA@isocpp.org Sat Nov 25 13:08:06 2017
Return-path: <std-proposals+bncBCXY5TXHWYJRBKN24XIAKGQEAIDT2LA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f69.google.com ([209.85.215.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCXY5TXHWYJRBKN24XIAKGQEAIDT2LA@isocpp.org>)
	id 1eIZFc-0005Ov-2v
	for gclcip-std-proposals@m.gmane.org; Sat, 25 Nov 2017 13:08:04 +0100
Original-Received: by mail-lf0-f69.google.com with SMTP id q21sf5799640lfb.12
        for <gclcip-std-proposals@m.gmane.org>; Sat, 25 Nov 2017 04:08:11 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1511611691; cv=pass;
        d=google.com; s=arc-20160816;
        b=mjpxVUf36PAV5GL/W4kmkwFmsZLyZ7FMBnY3IbgjkoykSpLu6VFdp6aTwN42srXGgd
         s1gWnkumaH2WPtesQwU3MwXvB++cQMXuzO93G1tMhGxOigPn+fNoMrIIZtv9puGptLOG
         uWTBSR+pXqW7yVY6Bt/T/Yg4tTyEiy5l5tp5lXLm7+Ncovzp3pluZl1vtSgJcZM+0FNs
         8WrnnBENEKhNRFUmJlp+D5kScJGjI1jk7k/O5x6yYLblqZeOTLd9chtbinobQo57+SLS
         SZX/RSlwTrSdF24WBUQJrFxVstx+s7szgwhSlzB3L++CflmoQ+VoXbVAU4yggs1x5dN/
         ac8A==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-language
         :in-reply-to:mime-version:user-agent:date:message-id:from:references
         :to:subject:arc-authentication-results:arc-message-signature
         :dkim-signature:arc-authentication-results;
        bh=WvwJ7Aw49dt5D5jNQ3i5zvZvH1sZC+tnb8vt7YaHidE=;
        b=k9wriujMyPqYIfTwpGbasfuTXmQdbrMAHrIBiu1+r3FSPzeMnn/fJ6o4SpfqgLscy9
         gM8GUqf26cAksjoGJrZx54dv83ag8fG2aVYabvsxUW0mYV4RQ1y3PWpEbqezmZmzB3nB
         8PxYWy6uGwmMe7q5ODicfsvop6y+Q88j+aGO7wXDlUkNMxyE6sU7iLmOLH9JtYTZfCj/
         q2DD7KMg7JGRQscReiI58INxT95X4OV9RKIaLRDeK/qISZED8MX57lIjV9pw/DGcikKa
         RSsYbiSRO7fgmX7W/AJSvLWO6SrX7JCxNYSZ4fql612Y9jRvGnzH7sYC+bMLN8ugiYvL
         PiSQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=DnGc4qZK;
       spf=pass (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-language:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=WvwJ7Aw49dt5D5jNQ3i5zvZvH1sZC+tnb8vt7YaHidE=;
        b=k7Pe46C9IjqgtpLCGzYrBbAZrmZylKXC5B1OtuXL7fVcenRnZuQ38fhCoANn4ms+d9
         kk/9AXC653v70ojTuKqf1YrrBeTbcgu4174zMHo/15z1DkiXDZj/mKKoSdNDC3RmVQ4c
         0gYnpDgntDJJ36JuNLwj/xuHlJeF+HV2//RJp0Ns/Sm48BAGNurMMxXyltrPOBPm561V
         pLlOe7woLfW9BKy0RxrjAqIlFSp/cxsSYS4gaYAHf/1mRKMtP/pLzqbTke3M1ttpJl/a
         kPu3llzhcEvfta+0fawBZz2dIwoCHrfzTYCqLKh01JaogIjutbJ/T7WhA1EAtkHp3XLx
         CQ+w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=WvwJ7Aw49dt5D5jNQ3i5zvZvH1sZC+tnb8vt7YaHidE=;
        b=PtQlGepKhHzHHe4uqPVLCQumZBiqyIsMn69qUpIvMYa7Ikqt2H8isRGXkbvsxZQAax
         GU9M8S9JVBUkil/7kmcg35FRP64eY5xxPUKWdCdynwo1wgs4etjdK9D09pVUk3Q/43Ze
         NMDt9BsRgNhxrGDWqWZcwlPjJlksuUy4AP2bddCrTbvN1kXcxn8jJECh5N/Zl43eBX0D
         1IW+BaZkDnpxFnSxF9HKKwkSBc4EaYwR2DajFG5E3JBWYi3UPkOFayftaP+KVp4qzF6q
         guvkLB2uCVpQt0bLS/G5lILO+VcLG5yVVpGLs6yoVoxpYplrnMts430AjR43EHbkeZ+E
         N 
X-Gm-Message-State: AJaThX5fAFaRCBw80yXEiP+r5Y/zRD3vN2WI0FLi9xtMsp5jOoDU/sjR
	67zmg9ympH9rlBbvYoxPQhht0A==
X-Google-Smtp-Source: AGs4zMbd8Lmztl5LYQoGBGQjKMn/5CmN9/f/PO7+vLrAMewfx/F4DBpvLOS052vnX8Bmro6s6tOPEQ==
X-Received: by 10.25.83.16 with SMTP id h16mr1055380lfb.3.1511611691594;
        Sat, 25 Nov 2017 04:08:11 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.46.66.3 with SMTP id p3ls1372499lja.11.gmail; Sat, 25 Nov 2017
 04:08:09 -0800 (PST)
X-Received: by 10.46.29.13 with SMTP id d13mr11323944ljd.8.1511611689596;
        Sat, 25 Nov 2017 04:08:09 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1511611689; cv=none;
        d=google.com; s=arc-20160816;
        b=Tlt1aedeWJ96MI9peVJqqJ/3/MA71B352u4TbXRnJGvuXkX9GiLRZLnxFp71sXPoIc
         wg+gyR05i8BgsJ8pINzoFFWrene8qaWy4BSva+P28VEvBsda+bt8LhyHt1jLm0Eww0Wo
         FuoJg5dQ3bjsxw3mzFcJOvIUF5b5gk02xqTr63JyAbrBWvHAvk+oOl2I63FZOCnyqQKv
         I1Gp7dTGpNatQFewtPGb71MhXwHvnqc8isL2HL5oBEB4WmHA4qTO1BO9PvvVJeWF9IDc
         /2ADWE71Ch/AyklsUXBhitQa6afK7j0ZwCLya3sSK97tY3ABj4s5mQTILS+F7Awxpg0s
         dfGw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:from:references:to:subject
         :dkim-signature:arc-authentication-results;
        bh=Om+drFgAviFiHwnG00RKmtaV+kyAE8AUAFUXqnTKb8o=;
        b=cNWFrTtihGFbDAFO2/zcIRp4gnRmt0pcCcxaELY1o0agcH7ewWUu6k2mgBN5FDDtB7
         LWVxqlkAV7FzmuNc+yB2DPqPyBjQzHlsjcrDa1LTIvTglawrRdwDEoDYcZo8MZK1ccHX
         zQMg8xsVQB7uHkjyW0MblMGkp7wMdd6ZQqbZDSSby7qml2JFyDc4VovIeKAGNosv20Bi
         O2MEWEbX4ff+uLnC6uVdksJ/LPtz2NnlPECC3bnc9Q0qbqhlj9z1i7strtU5UVZ6k9Fw
         lcS65pLZArW/y/naJrR1WsLl+7t95/yzcDrv5Z7JCrEQn84Ep4ABzuJF2TiRfDFgiR+B
         W9zA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=DnGc4qZK;
       spf=pass (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id u3sor3312324lju.11.2017.11.25.04.08.09
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Sat, 25 Nov 2017 04:08:09 -0800 (PST)
Received-SPF: pass (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.46.66.140 with SMTP id h12mr11139475ljf.140.1511611689018;
        Sat, 25 Nov 2017 04:08:09 -0800 (PST)
Original-Received: from [192.168.1.2] (broadband-178-140-150-13.moscow.rt.ru. [178.140.150.13])
        by smtp.googlemail.com with ESMTPSA id f126sm4080914lff.52.2017.11.25.04.08.07
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 25 Nov 2017 04:08:07 -0800 (PST)
In-Reply-To: <3031585.uCQqKE2Qzv@tjmaciei-mobl1>
Content-Language: ru
X-Original-Sender: andrey.semashev@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=DnGc4qZK;       spf=pass
 (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;       dmarc=pass
 (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:35513
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/35513>

On 11/25/17 08:37, Thiago Macieira wrote:
> On sexta-feira, 24 de novembro de 2017 21:14:19 PST Andrey Semashev wrote:
>> On 11/25/17 03:09, Thiago Macieira wrote:
>>> On sexta-feira, 24 de novembro de 2017 10:46:09 PST Nicol Bolas wrote:
>>>> Bit-*rotation* is a less common operation than bit shifting.
>>>
>>> Proof: the fact that there's no built-in rotation operator in any major
>>> language, not even in C that was supposed to be "portable assembly".
>>> Especially in the olden days when you coudn't count on the compilers
>>> understanding what you meant.
>>>
>>> And if you want an even less common operation: rotate with carry.
>>
>> That's not exactly a proof, more of a conservative approach of language
>> designers. Every widespread CPU architecture includes rotation
>> instructions because theys are important in some areas.
> 
> No doubt they are, because unlike a high-level language, executing a rotation
> in assembly couldn't be executed in one cycle due to the data dependency[*],
> not to mention the need to use one extra register, possibly two. A dedicated
> instruction for rotation (and one more for rotate-with-carry) can probably
> execute in one cycle by just reusing the barrel-shifter.
> 
> The high-level language doesn't need that because the compilers are smart
> enough to notice the pattern of two-shifts-and-or as a rotation and write
> assembly accordingly.

Well, the compilers were not always that smart, and if we had the 
standard rotation functions or operators from the start, people wouldn't 
have to write assembler code and compilers wouldn't need to be taught to 
recognize certain code patterns. Reliability of this recognition has 
always been and will be a question of QoI, i.e. something that cannot be 
relied on.

I'm not arguing for operators or functions approach here. I'm saying 
that dedicated rotation operations are long overdue in C and C++.

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/9a7a898c-9e14-532f-fc4a-11d0aa5a1bf7%40gmail.com.

.
