DavidTruby created this revision.
Herald added subscribers: ctetreau, psnobl, tschuett.
Herald added a reviewer: efriedma.
DavidTruby requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch implements support for the +, -, *, / and % operators on sizeless SVE
types. Support for these operators on svbool_t is excluded.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120323

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CodeGen/aarch64-sve-vector-ops.c
  clang/test/Sema/aarch64-sve-vector-ops.c
  clang/test/Sema/sizeless-1.c
  clang/test/SemaCXX/sizeless-1.cpp

Index: clang/test/SemaCXX/sizeless-1.cpp
===================================================================
--- clang/test/SemaCXX/sizeless-1.cpp
+++ clang/test/SemaCXX/sizeless-1.cpp
@@ -211,11 +211,6 @@
   __real init_int8; // expected-error {{invalid type 'svint8_t'}}
   __imag init_int8; // expected-error {{invalid type 'svint8_t'}}
 
-  local_int8 + init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 - init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 *init_int8;   // expected-error {{invalid operands to binary expression}}
-  local_int8 / init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 % init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 &init_int8;   // expected-error {{invalid operands to binary expression}}
   local_int8 | init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 ^ init_int8;  // expected-error {{invalid operands to binary expression}}
@@ -230,11 +225,6 @@
   local_int8 &&init_int8;  // expected-error {{invalid operands to binary expression}} expected-error {{not contextually convertible}}
   local_int8 || init_int8; // expected-error {{invalid operands to binary expression}} expected-error {{not contextually convertible}}
 
-  local_int8 += init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 -= init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 *= init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 /= init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 %= init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 &= init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 |= init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 ^= init_int8;  // expected-error {{invalid operands to binary expression}}
Index: clang/test/Sema/sizeless-1.c
===================================================================
--- clang/test/Sema/sizeless-1.c
+++ clang/test/Sema/sizeless-1.c
@@ -199,11 +199,6 @@
   __real init_int8; // expected-error {{invalid type 'svint8_t'}}
   __imag init_int8; // expected-error {{invalid type 'svint8_t'}}
 
-  local_int8 + init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 - init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 *init_int8;   // expected-error {{invalid operands to binary expression}}
-  local_int8 / init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 % init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 &init_int8;   // expected-error {{invalid operands to binary expression}}
   local_int8 | init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 ^ init_int8;  // expected-error {{invalid operands to binary expression}}
@@ -218,11 +213,6 @@
   local_int8 &&init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 || init_int8; // expected-error {{invalid operands to binary expression}}
 
-  local_int8 += init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 -= init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 *= init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 /= init_int8;  // expected-error {{invalid operands to binary expression}}
-  local_int8 %= init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 &= init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 |= init_int8;  // expected-error {{invalid operands to binary expression}}
   local_int8 ^= init_int8;  // expected-error {{invalid operands to binary expression}}
Index: clang/test/Sema/aarch64-sve-vector-ops.c
===================================================================
--- /dev/null
+++ clang/test/Sema/aarch64-sve-vector-ops.c
@@ -0,0 +1,645 @@
+// RUN: %clang_cc1 -verify -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only %s
+
+// REQUIRES: aarch64-registered-target || arm-registered-target
+
+#include <arm_sve.h>
+
+void add(svint8_t i8, svint16_t i16, svint32_t i32, svint64_t i64,
+         svuint8_t u8, svuint16_t u16, svuint32_t u32, svuint64_t u64,
+         svfloat16_t f16, svfloat32_t f32, svfloat64_t f64,
+         svbool_t b) {
+  (void)(b + b); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i8 + b); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 + i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 + i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 + i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 + u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 + u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 + u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 + f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u8 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u8 + i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 + i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 + i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 + u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 + u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 + u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 + f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i16 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i16 + i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 + i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 + i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 + u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 + u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 + u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 + f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u16 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u16 + i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 + i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 + i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 + u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 + u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 + u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 + f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i32 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i32 + i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 + i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 + i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 + u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 + u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 + u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 + f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u32 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u32 + i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 + i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 + i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 + u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 + u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 + u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 + f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i64 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i64 + i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 + i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 + i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 + u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 + u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 + u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 + f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u64 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u64 + i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 + i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 + i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 + u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 + u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 + u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 + f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f16 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f16 + i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 + i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 + i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 + i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 + u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 + u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 + u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 + f32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f32 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f32 + i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 + i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 + i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 + i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 + u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 + u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 + u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 + f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f64 + b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f64 + i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 + i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 + i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 + i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 + u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 + u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 + u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 + f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 + f32); // expected-error{{invalid operands to binary expression}}
+}
+
+void sub(svint8_t i8, svint16_t i16, svint32_t i32, svint64_t i64,
+         svuint8_t u8, svuint16_t u16, svuint32_t u32, svuint64_t u64,
+         svfloat16_t f16, svfloat32_t f32, svfloat64_t f64,
+         svbool_t b) {
+  (void)(b - b); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i8 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i8 - i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 - i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 - i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 - u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 - u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 - u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 - f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u8 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u8 - i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 - i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 - i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 - u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 - u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 - u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 - f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i16 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i16 - i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 - i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 - i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 - u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 - u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 - u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 - f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u16 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u16 - i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 - i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 - i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 - u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 - u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 - u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 - f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i32 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i32 - i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 - i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 - i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 - u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 - u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 - u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 - f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u32 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u32 - i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 - i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 - i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 - u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 - u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 - u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 - f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i64 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i64 - i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 - i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 - i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 - u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 - u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 - u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 - f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u64 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u64 - i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 - i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 - i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 - u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 - u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 - u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 - f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f16 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f16 - i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 - i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 - i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 - i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 - u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 - u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 - u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 - f32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f32 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f32 - i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 - i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 - i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 - i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 - u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 - u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 - u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 - f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f64 - b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f64 - i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 - i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 - i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 - i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 - u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 - u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 - u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 - f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 - f32); // expected-error{{invalid operands to binary expression}}
+}
+
+void mul(svint8_t i8, svint16_t i16, svint32_t i32, svint64_t i64,
+         svuint8_t u8, svuint16_t u16, svuint32_t u32, svuint64_t u64,
+         svfloat16_t f16, svfloat32_t f32, svfloat64_t f64,
+         svbool_t b) {
+  (void)(b * b); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i8 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i8 * i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 * i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 * i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 * u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 * u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 * u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 * f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u8 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u8 * i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 * i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 * i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 * u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 * u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 * u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 * f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i16 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i16 * i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 * i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 * i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 * u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 * u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 * u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 * f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u16 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u16 * i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 * i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 * i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 * u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 * u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 * u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 * f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i32 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i32 * i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 * i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 * i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 * u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 * u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 * u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 * f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u32 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u32 * i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 * i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 * i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 * u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 * u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 * u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 * f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i64 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i64 * i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 * i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 * i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 * u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 * u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 * u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 * f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u64 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u64 * i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 * i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 * i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 * u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 * u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 * u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 * f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f16 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f16 * i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 * i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 * i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 * i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 * u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 * u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 * u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 * f32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f32 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f32 * i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 * i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 * i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 * i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 * u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 * u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 * u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 * f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f64 * b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f64 * i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 * i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 * i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 * i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 * u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 * u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 * u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 * f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 * f32); // expected-error{{invalid operands to binary expression}}
+}
+
+void div(svint8_t i8, svint16_t i16, svint32_t i32, svint64_t i64,
+         svuint8_t u8, svuint16_t u16, svuint32_t u32, svuint64_t u64,
+         svfloat16_t f16, svfloat32_t f32, svfloat64_t f64,
+         svbool_t b) {
+  (void)(b / b); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i8 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i8 / i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 / i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 / i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 / u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 / u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 / u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 / f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u8 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u8 / i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 / i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 / i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 / u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 / u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 / u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 / f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i16 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i16 / i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 / i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 / i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 / u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 / u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 / u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 / f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u16 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u16 / i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 / i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 / i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 / u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 / u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 / u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 / f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i32 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i32 / i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 / i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 / i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 / u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 / u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 / u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 / f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u32 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u32 / i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 / i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 / i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 / u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 / u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 / u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 / f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i64 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i64 / i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 / i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 / i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 / u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 / u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 / u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 / f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u64 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u64 / i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 / i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 / i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 / u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 / u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 / u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 / f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f16 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f16 / i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 / i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 / i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 / i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 / u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 / u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 / u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 / f32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f32 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f32 / i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 / i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 / i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 / i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 / u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 / u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 / u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 / f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f64 / b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f64 / i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 / i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 / i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 / i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 / u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 / u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 / u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 / f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 / f32); // expected-error{{invalid operands to binary expression}}
+}
+
+void mod(svint8_t i8, svint16_t i16, svint32_t i32, svint64_t i64,
+         svuint8_t u8, svuint16_t u16, svuint32_t u32, svuint64_t u64,
+         svfloat16_t f16, svfloat32_t f32, svfloat64_t f64,
+         svbool_t b) {
+  (void)(b % b); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i8 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i8 % i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 % i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 % i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 % u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 % u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 % u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 % f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i8 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u8 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u8 % i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 % i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 % i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 % u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 % u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 % u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 % f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u8 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i16 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i16 % i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 % i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 % i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 % u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i16 % u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 % u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 % f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i16 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u16 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u16 % i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 % i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 % i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 % u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u16 % u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 % u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 % f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u16 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i32 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i32 % i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 % i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 % i64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 % u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i32 % u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 % u64); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 % f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i32 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u32 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u32 % i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 % i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 % i64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 % u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u32 % u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 % u64); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 % f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u32 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(i64 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(i64 % i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 % i16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 % i32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 % u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(i64 % u16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 % u32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 % f32); // expected-error{{invalid operands to binary expression}}
+  (void)(i64 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(u64 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(u64 % i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 % i16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 % i32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 % u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(u64 % u16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 % u32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 % f32); // expected-error{{invalid operands to binary expression}}
+  (void)(u64 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f16 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f16 % i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 % i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 % i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 % i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 % u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f16 % u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 % u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 % f32); // expected-error{{invalid operands to binary expression}}
+  (void)(f16 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f32 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f32 % i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 % i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 % i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 % i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 % u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f32 % u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 % u64); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f32 % f64); // expected-error{{invalid operands to binary expression}}
+
+  (void)(f64 % b);   // expected-error{{invalid operands to binary expression}}
+  (void)(f64 % i8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 % i16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 % i32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 % i64); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 % u8);  // expected-error{{invalid operands to binary expression}}
+  (void)(f64 % u16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 % u32); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 % f16); // expected-error{{invalid operands to binary expression}}
+  (void)(f64 % f32); // expected-error{{invalid operands to binary expression}}
+}
Index: clang/test/CodeGen/aarch64-sve-vector-ops.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-vector-ops.c
@@ -0,0 +1,379 @@
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN: -fallow-half-arguments-and-returns \
+// RUN:  -O1 -emit-llvm -o - %s 2>&1 | FileCheck %s
+
+#include <arm_sve.h>
+
+// ADDITION
+
+svint8_t add_i8(svint8_t a, svint8_t b) {
+  // CHECK-LABEL: add_i8
+  // CHECK: %add = add <vscale x 16 x i8> %b, %a
+  // CHECK-NEXT: ret <vscale x 16 x i8> %add
+  return a + b;
+}
+
+svint16_t add_i16(svint16_t a, svint16_t b) {
+  // CHECK-LABEL: add_i16
+  // CHECK: %add = add <vscale x 8 x i16> %b, %a
+  // CHECK-NEXT: ret <vscale x 8 x i16> %add
+  return a + b;
+}
+
+svint32_t add_i32(svint32_t a, svint32_t b) {
+  // CHECK-LABEL: add_i32
+  // CHECK: %add = add <vscale x 4 x i32> %b, %a
+  // CHECK-NEXT: ret <vscale x 4 x i32> %add
+  return a + b;
+}
+
+svint64_t add_i64(svint64_t a, svint64_t b) {
+  // CHECK-LABEL: add_i64
+  // CHECK: %add = add <vscale x 2 x i64> %b, %a
+  // CHECK-NEXT: ret <vscale x 2 x i64> %add
+  return a + b;
+}
+
+svuint8_t add_u8(svuint8_t a, svuint8_t b) {
+  // CHECK-LABEL: add_u8
+  // CHECK: %add = add <vscale x 16 x i8> %b, %a
+  // CHECK-NEXT: ret <vscale x 16 x i8> %add
+  return a + b;
+}
+
+svuint16_t add_u16(svuint16_t a, svuint16_t b) {
+  // CHECK-LABEL: add_u16
+  // CHECK: %add = add <vscale x 8 x i16> %b, %a
+  // CHECK-NEXT: ret <vscale x 8 x i16> %add
+  return a + b;
+}
+
+svuint32_t add_u32(svuint32_t a, svuint32_t b) {
+  // CHECK-LABEL: add_u32
+  // CHECK: %add = add <vscale x 4 x i32> %b, %a
+  // CHECK-NEXT: ret <vscale x 4 x i32> %add
+  return a + b;
+}
+
+svuint64_t add_u64(svuint64_t a, svuint64_t b) {
+  // CHECK-LABEL: add_u64
+  // CHECK: %add = add <vscale x 2 x i64> %b, %a
+  // CHECK-NEXT: ret <vscale x 2 x i64> %add
+  return a + b;
+}
+
+svfloat16_t add_f16(svfloat16_t a, svfloat16_t b) {
+  // CHECK-LABEL: add_f16
+  // CHECK: %add = fadd <vscale x 8 x half> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x half> %add
+  return a + b;
+}
+
+svfloat32_t add_f32(svfloat32_t a, svfloat32_t b) {
+  // CHECK-LABEL: add_f32
+  // CHECK: %add = fadd <vscale x 4 x float> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x float> %add
+  return a + b;
+}
+
+svfloat64_t add_f64(svfloat64_t a, svfloat64_t b) {
+  // CHECK-LABEL: add_f64
+  // CHECK: %add = fadd <vscale x 2 x double> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x double> %add
+  return a + b;
+}
+
+// SUBTRACTION
+
+svint8_t sub_i8(svint8_t a, svint8_t b) {
+  // CHECK-LABEL: sub_i8
+  // CHECK: %sub = sub <vscale x 16 x i8> %a, %b
+  // CHECK-NEXT: ret <vscale x 16 x i8> %sub
+  return a - b;
+}
+
+svint16_t sub_i16(svint16_t a, svint16_t b) {
+  // CHECK-LABEL: sub_i16
+  // CHECK: %sub = sub <vscale x 8 x i16> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x i16> %sub
+  return a - b;
+}
+
+svint32_t sub_i32(svint32_t a, svint32_t b) {
+  // CHECK-LABEL: sub_i32
+  // CHECK: %sub = sub <vscale x 4 x i32> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x i32> %sub
+  return a - b;
+}
+
+svint64_t sub_i64(svint64_t a, svint64_t b) {
+  // CHECK-LABEL: sub_i64
+  // CHECK: %sub = sub <vscale x 2 x i64> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x i64> %sub
+  return a - b;
+}
+
+svuint8_t sub_u8(svuint8_t a, svuint8_t b) {
+  // CHECK-LABEL: sub_u8
+  // CHECK: %sub = sub <vscale x 16 x i8> %a, %b
+  // CHECK-NEXT: ret <vscale x 16 x i8> %sub
+  return a - b;
+}
+
+svuint16_t sub_u16(svuint16_t a, svuint16_t b) {
+  // CHECK-LABEL: sub_u16
+  // CHECK: %sub = sub <vscale x 8 x i16> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x i16> %sub
+  return a - b;
+}
+
+svuint32_t sub_u32(svuint32_t a, svuint32_t b) {
+  // CHECK-LABEL: sub_u32
+  // CHECK: %sub = sub <vscale x 4 x i32> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x i32> %sub
+  return a - b;
+}
+
+svuint64_t sub_u64(svuint64_t a, svuint64_t b) {
+  // CHECK-LABEL: sub_u64
+  // CHECK: %sub = sub <vscale x 2 x i64> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x i64> %sub
+  return a - b;
+}
+
+svfloat16_t sub_f16(svfloat16_t a, svfloat16_t b) {
+  // CHECK-LABEL: sub_f16
+  // CHECK: %sub = fsub <vscale x 8 x half> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x half> %sub
+  return a - b;
+}
+
+svfloat32_t sub_f32(svfloat32_t a, svfloat32_t b) {
+  // CHECK-LABEL: sub_f32
+  // CHECK: %sub = fsub <vscale x 4 x float> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x float> %sub
+  return a - b;
+}
+
+svfloat64_t sub_f64(svfloat64_t a, svfloat64_t b) {
+  // CHECK-LABEL: sub_f64
+  // CHECK: %sub = fsub <vscale x 2 x double> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x double> %sub
+  return a - b;
+}
+
+// MULTIPLICATION
+
+svint8_t mul_i8(svint8_t a, svint8_t b) {
+  // CHECK-LABEL: mul_i8
+  // CHECK: %mul = mul <vscale x 16 x i8> %b, %a
+  // CHECK-NEXT: ret <vscale x 16 x i8> %mul
+  return a * b;
+}
+
+svint16_t mul_i16(svint16_t a, svint16_t b) {
+  // CHECK-LABEL: mul_i16
+  // CHECK: %mul = mul <vscale x 8 x i16> %b, %a
+  // CHECK-NEXT: ret <vscale x 8 x i16> %mul
+  return a * b;
+}
+
+svint32_t mul_i32(svint32_t a, svint32_t b) {
+  // CHECK-LABEL: mul_i32
+  // CHECK: %mul = mul <vscale x 4 x i32> %b, %a
+  // CHECK-NEXT: ret <vscale x 4 x i32> %mul
+  return a * b;
+}
+
+svint64_t mul_i64(svint64_t a, svint64_t b) {
+  // CHECK-LABEL: mul_i64
+  // CHECK: %mul = mul <vscale x 2 x i64> %b, %a
+  // CHECK-NEXT: ret <vscale x 2 x i64> %mul
+  return a * b;
+}
+
+svuint8_t mul_u8(svuint8_t a, svuint8_t b) {
+  // CHECK-LABEL: mul_u8
+  // CHECK: %mul = mul <vscale x 16 x i8> %b, %a
+  // CHECK-NEXT: ret <vscale x 16 x i8> %mul
+  return a * b;
+}
+
+svuint16_t mul_u16(svuint16_t a, svuint16_t b) {
+  // CHECK-LABEL: mul_u16
+  // CHECK: %mul = mul <vscale x 8 x i16> %b, %a
+  // CHECK-NEXT: ret <vscale x 8 x i16> %mul
+  return a * b;
+}
+
+svuint32_t mul_u32(svuint32_t a, svuint32_t b) {
+  // CHECK-LABEL: mul_u32
+  // CHECK: %mul = mul <vscale x 4 x i32> %b, %a
+  // CHECK-NEXT: ret <vscale x 4 x i32> %mul
+  return a * b;
+}
+
+svuint64_t mul_u64(svuint64_t a, svuint64_t b) {
+  // CHECK-LABEL: mul_u64
+  // CHECK: %mul = mul <vscale x 2 x i64> %b, %a
+  // CHECK-NEXT: ret <vscale x 2 x i64> %mul
+  return a * b;
+}
+
+svfloat16_t mul_f16(svfloat16_t a, svfloat16_t b) {
+  // CHECK-LABEL: mul_f16
+  // CHECK: %mul = fmul <vscale x 8 x half> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x half> %mul
+  return a * b;
+}
+
+svfloat32_t mul_f32(svfloat32_t a, svfloat32_t b) {
+  // CHECK-LABEL: mul_f32
+  // CHECK: %mul = fmul <vscale x 4 x float> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x float> %mul
+  return a * b;
+}
+
+svfloat64_t mul_f64(svfloat64_t a, svfloat64_t b) {
+  // CHECK-LABEL: mul_f64
+  // CHECK: %mul = fmul <vscale x 2 x double> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x double> %mul
+  return a * b;
+}
+
+// DIVISION
+
+svint8_t div_i8(svint8_t a, svint8_t b) {
+  // CHECK-LABEL: div_i8
+  // CHECK: %div = sdiv <vscale x 16 x i8> %a, %b
+  // CHECK-NEXT: ret <vscale x 16 x i8> %div
+  return a / b;
+}
+
+svint16_t div_i16(svint16_t a, svint16_t b) {
+  // CHECK-LABEL: div_i16
+  // CHECK: %div = sdiv <vscale x 8 x i16> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x i16> %div
+  return a / b;
+}
+
+svint32_t div_i32(svint32_t a, svint32_t b) {
+  // CHECK-LABEL: div_i32
+  // CHECK: %div = sdiv <vscale x 4 x i32> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x i32> %div
+  return a / b;
+}
+
+svint64_t div_i64(svint64_t a, svint64_t b) {
+  // CHECK-LABEL: div_i64
+  // CHECK: %div = sdiv <vscale x 2 x i64> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x i64> %div
+  return a / b;
+}
+
+svuint8_t div_u8(svuint8_t a, svuint8_t b) {
+  // CHECK-LABEL: div_u8
+  // CHECK: %div = udiv <vscale x 16 x i8> %a, %b
+  // CHECK-NEXT: ret <vscale x 16 x i8> %div
+  return a / b;
+}
+
+svuint16_t div_u16(svuint16_t a, svuint16_t b) {
+  // CHECK-LABEL: div_u16
+  // CHECK: %div = udiv <vscale x 8 x i16> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x i16> %div
+  return a / b;
+}
+
+svuint32_t div_u32(svuint32_t a, svuint32_t b) {
+  // CHECK-LABEL: div_u32
+  // CHECK: %div = udiv <vscale x 4 x i32> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x i32> %div
+  return a / b;
+}
+
+svuint64_t div_u64(svuint64_t a, svuint64_t b) {
+  // CHECK-LABEL: div_u64
+  // CHECK: %div = udiv <vscale x 2 x i64> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x i64> %div
+  return a / b;
+}
+
+svfloat16_t div_f16(svfloat16_t a, svfloat16_t b) {
+  // CHECK-LABEL: div_f16
+  // CHECK: %div = fdiv <vscale x 8 x half> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x half> %div
+  return a / b;
+}
+
+svfloat32_t div_f32(svfloat32_t a, svfloat32_t b) {
+  // CHECK-LABEL: div_f32
+  // CHECK: %div = fdiv <vscale x 4 x float> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x float> %div
+  return a / b;
+}
+
+svfloat64_t div_f64(svfloat64_t a, svfloat64_t b) {
+  // CHECK-LABEL: div_f64
+  // CHECK: %div = fdiv <vscale x 2 x double> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x double> %div
+  return a / b;
+}
+
+// REMAINDER
+
+svint8_t rem_i8(svint8_t a, svint8_t b) {
+  // CHECK-LABEL: rem_i8
+  // CHECK: %rem = srem <vscale x 16 x i8> %a, %b
+  // CHECK-NEXT: ret <vscale x 16 x i8> %rem
+  return a % b;
+}
+
+svint16_t rem_i16(svint16_t a, svint16_t b) {
+  // CHECK-LABEL: rem_i16
+  // CHECK: %rem = srem <vscale x 8 x i16> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x i16> %rem
+  return a % b;
+}
+
+svint32_t rem_i32(svint32_t a, svint32_t b) {
+  // CHECK-LABEL: rem_i32
+  // CHECK: %rem = srem <vscale x 4 x i32> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x i32> %rem
+  return a % b;
+}
+
+svint64_t rem_i64(svint64_t a, svint64_t b) {
+  // CHECK-LABEL: rem_i64
+  // CHECK: %rem = srem <vscale x 2 x i64> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x i64> %rem
+  return a % b;
+}
+
+svuint8_t rem_u8(svuint8_t a, svuint8_t b) {
+  // CHECK-LABEL: rem_u8
+  // CHECK: %rem = urem <vscale x 16 x i8> %a, %b
+  // CHECK-NEXT: ret <vscale x 16 x i8> %rem
+  return a % b;
+}
+
+svuint16_t rem_u16(svuint16_t a, svuint16_t b) {
+  // CHECK-LABEL: rem_u16
+  // CHECK: %rem = urem <vscale x 8 x i16> %a, %b
+  // CHECK-NEXT: ret <vscale x 8 x i16> %rem
+  return a % b;
+}
+
+svuint32_t rem_u32(svuint32_t a, svuint32_t b) {
+  // CHECK-LABEL: rem_u32
+  // CHECK: %rem = urem <vscale x 4 x i32> %a, %b
+  // CHECK-NEXT: ret <vscale x 4 x i32> %rem
+  return a % b;
+}
+
+svuint64_t rem_u64(svuint64_t a, svuint64_t b) {
+  // CHECK-LABEL: rem_u64
+  // CHECK: %rem = urem <vscale x 2 x i64> %a, %b
+  // CHECK-NEXT: ret <vscale x 2 x i64> %rem
+  return a % b;
+}
Index: clang/lib/Sema/SemaExpr.cpp
===================================================================
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -10310,6 +10310,29 @@
   return QualType();
 }
 
+QualType Sema::CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS,
+                                           SourceLocation Loc) {
+  QualType LHSType = LHS.get()->getType().getUnqualifiedType();
+  QualType RHSType = RHS.get()->getType().getUnqualifiedType();
+
+  const BuiltinType *LHSVecType = LHSType->getAs<BuiltinType>();
+  const BuiltinType *RHSVecType = RHSType->getAs<BuiltinType>();
+
+  unsigned DiagID = diag::err_typecheck_invalid_operands;
+  if (LHSVecType->isSVEBool() || RHSVecType->isSVEBool()) {
+    Diag(Loc, DiagID) << LHSType << RHSType << LHS.get()->getSourceRange()
+                      << RHS.get()->getSourceRange();
+    return QualType();
+  }
+
+  if (Context.hasSameType(LHSType, RHSType))
+    return LHSType;
+
+  Diag(Loc, DiagID) << LHSType << RHSType << LHS.get()->getSourceRange()
+                    << RHS.get()->getSourceRange();
+  return QualType();
+}
+
 // checkArithmeticNull - Detect when a NULL constant is used improperly in an
 // expression.  These are mainly cases where the null pointer is used as an
 // integer instead of a pointer.
@@ -10419,8 +10442,10 @@
   QualType RHSTy = RHS.get()->getType();
   if (LHSTy->isVectorType() || RHSTy->isVectorType())
     return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign,
-                               /*AllowBothBool*/getLangOpts().AltiVec,
-                               /*AllowBoolConversions*/false);
+                               /*AllowBothBool*/ getLangOpts().AltiVec,
+                               /*AllowBoolConversions*/ false);
+  if (LHSTy->isVLSTBuiltinType() || RHSTy->isVLSTBuiltinType())
+    return CheckSizelessVectorOperands(LHS, RHS, Loc);
   if (!IsDiv &&
       (LHSTy->isConstantMatrixType() || RHSTy->isConstantMatrixType()))
     return CheckMatrixMultiplyOperands(LHS, RHS, Loc, IsCompAssign);
@@ -10458,6 +10483,21 @@
     return InvalidOperands(Loc, LHS, RHS);
   }
 
+  if (LHS.get()->getType()->isVLSTBuiltinType() &&
+      RHS.get()->getType()->isVLSTBuiltinType()) {
+    if (LHS.get()
+            ->getType()
+            ->getSveEltType(Context)
+            ->hasIntegerRepresentation() &&
+        RHS.get()
+            ->getType()
+            ->getSveEltType(Context)
+            ->hasIntegerRepresentation())
+      return CheckSizelessVectorOperands(LHS, RHS, Loc);
+
+    return InvalidOperands(Loc, LHS, RHS);
+  }
+
   QualType compType = UsualArithmeticConversions(
       LHS, RHS, Loc, IsCompAssign ? ACK_CompAssign : ACK_Arithmetic);
   if (LHS.isInvalid() || RHS.isInvalid())
@@ -10763,6 +10803,14 @@
     return compType;
   }
 
+  if (LHS.get()->getType()->isVLSTBuiltinType() ||
+      RHS.get()->getType()->isVLSTBuiltinType()) {
+    QualType compType = CheckSizelessVectorOperands(LHS, RHS, Loc);
+    if (CompLHSTy)
+      *CompLHSTy = compType;
+    return compType;
+  }
+
   if (LHS.get()->getType()->isConstantMatrixType() ||
       RHS.get()->getType()->isConstantMatrixType()) {
     QualType compType =
@@ -10867,6 +10915,14 @@
     return compType;
   }
 
+  if (LHS.get()->getType()->isVLSTBuiltinType() ||
+      RHS.get()->getType()->isVLSTBuiltinType()) {
+    QualType compType = CheckSizelessVectorOperands(LHS, RHS, Loc);
+    if (CompLHSTy)
+      *CompLHSTy = compType;
+    return compType;
+  }
+
   if (LHS.get()->getType()->isConstantMatrixType() ||
       RHS.get()->getType()->isConstantMatrixType()) {
     QualType compType =
Index: clang/lib/AST/Type.cpp
===================================================================
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -2105,6 +2105,11 @@
     return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
   if (const auto *VT = dyn_cast<MatrixType>(CanonicalType))
     return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
+  if (CanonicalType->isVLSTBuiltinType()) {
+    const auto *VT = cast<BuiltinType>(CanonicalType);
+    return VT->getKind() >= BuiltinType::SveUint8 &&
+           VT->getKind() <= BuiltinType::SveUint64;
+  }
   return isUnsignedIntegerOrEnumerationType();
 }
 
Index: clang/include/clang/Sema/Sema.h
===================================================================
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -11891,6 +11891,10 @@
   QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS,
                                       SourceLocation Loc);
 
+  // type checking for sizeless vector binary operators.
+  QualType CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS,
+                                       SourceLocation Loc);
+
   /// Type checking for matrix binary operators.
   QualType CheckMatrixElementwiseOperands(ExprResult &LHS, ExprResult &RHS,
                                           SourceLocation Loc,
Index: clang/include/clang/AST/Type.h
===================================================================
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -2557,6 +2557,8 @@
     return getKind() >= Half && getKind() <= Ibm128;
   }
 
+  bool isSVEBool() const { return getKind() == Kind::SveBool; }
+
   /// Determines whether the given kind corresponds to a placeholder type.
   static bool isPlaceholderTypeKind(Kind K) {
     return K >= Overload;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to