Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / attr-riscv-rvv-vector-bits-call.c
blob70e1aefe7aaffbbfb87e4ee0432211faed8baa2f
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple riscv64-none-linux-gnu -target-feature +f -target-feature +d -target-feature +zve64d -mvscale-min=4 -mvscale-max=4 -S -O1 -emit-llvm -o - %s | FileCheck %s
4 // REQUIRES: riscv-registered-target
6 #include <riscv_vector.h>
8 typedef vint32m1_t fixed_int32m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen)));
9 typedef vfloat64m1_t fixed_float64m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen)));
11 //===----------------------------------------------------------------------===//
12 // Test caller/callee with VLST <-> VLAT
13 //===----------------------------------------------------------------------===//
15 // CHECK-LABEL: @sizeless_callee(
16 // CHECK-NEXT: entry:
17 // CHECK-NEXT: ret <vscale x 2 x i32> [[X:%.*]]
19 vint32m1_t sizeless_callee(vint32m1_t x) {
20 return x;
23 // CHECK-LABEL: @fixed_caller(
24 // CHECK-NEXT: entry:
25 // CHECK-NEXT: ret <vscale x 2 x i32> [[X_COERCE:%.*]]
27 fixed_int32m1_t fixed_caller(fixed_int32m1_t x) {
28 return sizeless_callee(x);
31 // CHECK-LABEL: @fixed_callee(
32 // CHECK-NEXT: entry:
33 // CHECK-NEXT: ret <vscale x 2 x i32> [[X_COERCE:%.*]]
35 fixed_int32m1_t fixed_callee(fixed_int32m1_t x) {
36 return x;
39 // CHECK-LABEL: @sizeless_caller(
40 // CHECK-NEXT: entry:
41 // CHECK-NEXT: ret <vscale x 2 x i32> [[X:%.*]]
43 vint32m1_t sizeless_caller(vint32m1_t x) {
44 return fixed_callee(x);
47 //===----------------------------------------------------------------------===//
48 // fixed, fixed
49 //===----------------------------------------------------------------------===//
51 // CHECK-LABEL: @call_int32_ff(
52 // CHECK-NEXT: entry:
53 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i32> @llvm.riscv.vadd.nxv2i32.nxv2i32.i64(<vscale x 2 x i32> poison, <vscale x 2 x i32> [[OP1_COERCE:%.*]], <vscale x 2 x i32> [[OP2_COERCE:%.*]], i64 8)
54 // CHECK-NEXT: ret <vscale x 2 x i32> [[TMP0]]
56 fixed_int32m1_t call_int32_ff(fixed_int32m1_t op1, fixed_int32m1_t op2) {
57 return __riscv_vadd(op1, op2, __riscv_v_fixed_vlen/32);
60 // CHECK-LABEL: @call_float64_ff(
61 // CHECK-NEXT: entry:
62 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 1 x double> @llvm.riscv.vfadd.nxv1f64.nxv1f64.i64(<vscale x 1 x double> poison, <vscale x 1 x double> [[OP1_COERCE:%.*]], <vscale x 1 x double> [[OP2_COERCE:%.*]], i64 7, i64 4)
63 // CHECK-NEXT: ret <vscale x 1 x double> [[TMP0]]
65 fixed_float64m1_t call_float64_ff(fixed_float64m1_t op1, fixed_float64m1_t op2) {
66 return __riscv_vfadd(op1, op2, __riscv_v_fixed_vlen/64);
69 //===----------------------------------------------------------------------===//
70 // fixed, scalable
71 //===----------------------------------------------------------------------===//
73 // CHECK-LABEL: @call_int32_fs(
74 // CHECK-NEXT: entry:
75 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i32> @llvm.riscv.vadd.nxv2i32.nxv2i32.i64(<vscale x 2 x i32> poison, <vscale x 2 x i32> [[OP1_COERCE:%.*]], <vscale x 2 x i32> [[OP2:%.*]], i64 8)
76 // CHECK-NEXT: ret <vscale x 2 x i32> [[TMP0]]
78 fixed_int32m1_t call_int32_fs(fixed_int32m1_t op1, vint32m1_t op2) {
79 return __riscv_vadd(op1, op2, __riscv_v_fixed_vlen/32);
82 // CHECK-LABEL: @call_float64_fs(
83 // CHECK-NEXT: entry:
84 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 1 x double> @llvm.riscv.vfadd.nxv1f64.nxv1f64.i64(<vscale x 1 x double> poison, <vscale x 1 x double> [[OP1_COERCE:%.*]], <vscale x 1 x double> [[OP2:%.*]], i64 7, i64 4)
85 // CHECK-NEXT: ret <vscale x 1 x double> [[TMP0]]
87 fixed_float64m1_t call_float64_fs(fixed_float64m1_t op1, vfloat64m1_t op2) {
88 return __riscv_vfadd(op1, op2, __riscv_v_fixed_vlen/64);
91 //===----------------------------------------------------------------------===//
92 // scalable, scalable
93 //===----------------------------------------------------------------------===//
95 // CHECK-LABEL: @call_int32_ss(
96 // CHECK-NEXT: entry:
97 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i32> @llvm.riscv.vadd.nxv2i32.nxv2i32.i64(<vscale x 2 x i32> poison, <vscale x 2 x i32> [[OP1:%.*]], <vscale x 2 x i32> [[OP2:%.*]], i64 8)
98 // CHECK-NEXT: ret <vscale x 2 x i32> [[TMP0]]
100 fixed_int32m1_t call_int32_ss(vint32m1_t op1, vint32m1_t op2) {
101 return __riscv_vadd(op1, op2, __riscv_v_fixed_vlen/32);
104 // CHECK-LABEL: @call_float64_ss(
105 // CHECK-NEXT: entry:
106 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 1 x double> @llvm.riscv.vfadd.nxv1f64.nxv1f64.i64(<vscale x 1 x double> poison, <vscale x 1 x double> [[OP1:%.*]], <vscale x 1 x double> [[OP2:%.*]], i64 7, i64 4)
107 // CHECK-NEXT: ret <vscale x 1 x double> [[TMP0]]
109 fixed_float64m1_t call_float64_ss(vfloat64m1_t op1, vfloat64m1_t op2) {
110 return __riscv_vfadd(op1, op2, __riscv_v_fixed_vlen/64);