From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 87C9B3858D34 for ; Wed, 12 Jun 2024 06:56:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87C9B3858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 87C9B3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718175385; cv=none; b=rAvLM7zxAy/zDrc4Kc0tl4+/Bbh9rgk12biSoUXyYpuz5fN+44UX+DBCu2HzrEUtrCDtMS7XQXWAtd6Uvl1KDPOrxK0gEthvqCYWQrKtcduKx9Sm4Ntm4bJavsQu9x3W6rtfJ7tpeBwowJxnvlhGbW0NvCqmljmq/3NUKxBH+Tg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718175385; c=relaxed/simple; bh=oEyfoPTVfRaRdh4o+DwofPQuSKb1hDXEolR6tZp93mg=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=l5Wx4cSFM2qcLyLbN0Qm7y0pNlmMCbfAl6mn840uauJklSEQUXjT7uABni9Y98yfR+kV3WESDjtLHywAg+93IxdIvd64IBUZZb8wbasBkVdWztnUAveTaMX6lV5c/4Z3jyVGLqXQDB6lM+5qs7i//sQ0TmTd8Qz6XbJMU1DAOkw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-52c7f7fdd24so2400250e87.1 for ; Tue, 11 Jun 2024 23:56:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718175382; x=1718780182; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=dFuELDMRMBpz767JTaWslQj7B/N+eQYIsg9n5jQbc10=; b=m0GbVfCkGik8rvbnTt/F6ukuWblZ91/8PDaXW/hLHkacsKsZaifMwOyT3na9m09/NY U5Une9MNGyCDbIMUSmTtsIP4v2JeXSxQYIqNBn5Jcr/dxv7jYtINPJoRt/kWlFNMYP89 TnN4yLqYWxmNW1NsZq7zn8M4JBx7u/mPfo1ImfM0AgxBNdYwraV4VADJh1l8pyc1Leij 7snxk28fUbYWFWlxPdlpxF6zFp68DRpKB+Oy2Ea955voe3VcsVSS3nvEnAtrbtUH2394 mHSFt887Mt4jsYf/VlSK7Y33zw1g/B8EIG+2o2XZF/LiizSjOI+9SppBKILWY9YQMkuM d99Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718175382; x=1718780182; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dFuELDMRMBpz767JTaWslQj7B/N+eQYIsg9n5jQbc10=; b=vBvLILINpCcdcoUMb2gmVOTiESlgZLy7GEWbC3XKm5qgtC3Db9+9+WSl/ayfZVZrL1 Ml6bWwcv5SDTjh+e/PRw8woC/SciRWLva3w91lR5cOUNU2yrhkbHUXswfKai1bw4OI0B CPO8GAmqUOP7NGKNZVeyGXKJz+yFZD645tCnxGfxW9+oi+5bHzcp/xZScgtT2MifFGGS wOAL64aNa1yX158zDCgqOs1R23UtGwmHLXQ/aSWI0Pra+rksRXf+xrpvVlxAQzuRe4yh 8ezw6A7wzNYBPjk+10yVcsIca/WWLPJr6wwVL7DB1Lz7OkDe19j5t3/P7YoA83VEdapX tinQ== X-Gm-Message-State: AOJu0Yy0mUluKr4jYUtZsSSRjPFRlXmQ00FXv6MAwMj7eVxJtvY+DRLo jYX1s3/Ut3t5m6b41KyB/0FxIGQs+LJNeDQZedie6ZaPquHZfnqlhlSZfbaq9ygVOhJYX34Xtgn itIkI1PrkntSy9QJe1XDQyk4SBaoBJV6+46o= X-Google-Smtp-Source: AGHT+IGKuOqZU4fwDES8RW/VK6vJ3R7lOIC0jUJlxD56HM+5sc2nxC0Adb08FGIsVizbe190rGQLIOIkXjm48siCJ00= X-Received: by 2002:a05:6512:110e:b0:52c:9252:f822 with SMTP id 2adb3069b0e04-52c9a3fd6e8mr573276e87.53.1718175381451; Tue, 11 Jun 2024 23:56:21 -0700 (PDT) MIME-Version: 1.0 From: Hanke Zhang Date: Wed, 12 Jun 2024 14:56:10 +0800 Message-ID: Subject: How to represent a fallthrough condtion (with no else) in "Match and Simplify"? To: GCC Development Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,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 List-Id: Hi, I'm trying to study "Match and Simplify" recently, and I had this sample code: int main() { int n = 1000; int *a = malloc (sizeof(int) * n); int *b = malloc (sizeof(int) * n); int *c = malloc (sizeof(int) * n); for (int i = 0; i < n; i++) { if (a[i] & b[i]) { a[i] ^= c[i]; } } } But this code cannot be vectorized very well. I hope it can become like this: int main() { int n = 1000; int *a = malloc (sizeof(int) * n); int *b = malloc (sizeof(int) * n); int *c = malloc (sizeof(int) * n); for (int i = 0; i < n; i++) { int cond = ((a[i] & b[i]) == 1); unsigned int mask = cond ? -1 : 0; a[i] ^= (c[i] & mask); } } This can finally result in concise and efficient vectorized instructions. But I want to know if this can be achieved through "Match and Simplify"? Because when I tried to write the pattern, I found that the condtional statement here seemed not to be matched well, as there is not an else block. Or is this not possible with "Match and Simplify"? Is it possible to implement it in if-conversion? Thanks Hanke Zhang