@@ -38,3 +38,63 @@ float32_t test_vrndns_f32(float32_t a) {
3838// LLVM: store float [[RES_COPY1]], ptr [[RET_P:%.*]], align 4,
3939// LLVM: [[RET_VAL:%.*]] = load float, ptr [[RET_P]], align 4,
4040// LLVM: ret float [[RET_VAL]]
41+
42+ float32x2_t test_vrnda_f32 (float32x2_t a ) {
43+ return vrnda_f32 (a );
44+ }
45+
46+ // CIR: cir.func internal private @vrnda_f32(%arg0: !cir.vector<!cir.float x 2>
47+ // CIR: cir.store %arg0, [[ARG_SAVE:%.*]] : !cir.vector<!cir.float x 2>, !cir.ptr<!cir.vector<!cir.float x 2>>
48+ // CIR: [[INTRIN_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
49+ // CIR: [[INTRIN_ARG_CAST:%.*]] = cir.cast(bitcast, [[INTRIN_ARG]] : !cir.vector<!cir.float x 2>), !cir.vector<!s8i x 8>
50+ // CIR: [[INTRIN_ARG_BACK:%.*]] = cir.cast(bitcast, [[INTRIN_ARG_CAST]] : !cir.vector<!s8i x 8>), !cir.vector<!cir.float x 2>
51+ // CIR: {{%.*}} = cir.llvm.intrinsic "llvm.round" [[INTRIN_ARG_BACK]] : (!cir.vector<!cir.float x 2>) -> !cir.vector<!cir.float x 2>
52+ // CIR: cir.return {{%.*}} : !cir.vector<!cir.float x 2>
53+
54+ // CIR-LABEL: test_vrnda_f32
55+ // CIR: cir.store %arg0, [[ARG_SAVE0:%.*]] : !cir.vector<!cir.float x 2>, !cir.ptr<!cir.vector<!cir.float x 2>>
56+ // CIR: [[FUNC_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
57+ // CIR: [[FUNC_RES:%.*]] = cir.call @vrnda_f32([[FUNC_ARG]]) : (!cir.vector<!cir.float x 2>) -> !cir.vector<!cir.float x 2>
58+ // CIR: cir.store [[FUNC_RES]], [[RET_P:%.*]] : !cir.vector<!cir.float x 2>, !cir.ptr<!cir.vector<!cir.float x 2>>
59+ // CIR: [[RET_VAL:%.*]] = cir.load [[RET_P]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
60+ // CIR: cir.return [[RET_VAL]] : !cir.vector<!cir.float x 2>
61+
62+ // LLVM: define dso_local <2 x float> @test_vrnda_f32(<2 x float> [[ARG:%.*]])
63+ // LLVM: store <2 x float> [[ARG]], ptr [[ARG_SAVE:%.*]], align 8
64+ // LLVM: [[P0:%.*]] = load <2 x float>, ptr [[ARG_SAVE]], align 8,
65+ // LLVM: store <2 x float> [[P0]], ptr [[P0_SAVE:%.*]], align 8,
66+ // LLVM: [[INTRIN_ARG:%.*]] = load <2 x float>, ptr [[P0_SAVE]], align 8,
67+ // LLVM: [[INTRIN_RES:%.*]] = call <2 x float> @llvm.round.v2f32(<2 x float> [[INTRIN_ARG]])
68+ // LLVM: store <2 x float> [[INTRIN_RES]], ptr [[RES_SAVE0:%.*]], align 8,
69+ // LLVM: [[RES_COPY0:%.*]] = load <2 x float>, ptr [[RES_SAVE0]], align 8,
70+ // LLVM: store <2 x float> [[RES_COPY0]], ptr [[RES_SAVE1:%.*]], align 8,
71+ // LLVM: [[RES_COPY1:%.*]] = load <2 x float>, ptr [[RES_SAVE1]], align 8,
72+ // LLVM: store <2 x float> [[RES_COPY1]], ptr [[RET_P:%.*]], align 8,
73+ // LLVM: [[RET_VAL:%.*]] = load <2 x float>, ptr [[RET_P]], align 8,
74+ // LLVM: ret <2 x float> [[RET_VAL]]
75+
76+ float32x4_t test_vrndaq_f32 (float32x4_t a ) {
77+ return vrndaq_f32 (a );
78+ }
79+
80+ // CIR: cir.func internal private @vrndaq_f32(%arg0: !cir.vector<!cir.float x 4>
81+ // CIR: cir.store %arg0, [[ARG_SAVE:%.*]] : !cir.vector<!cir.float x 4>, !cir.ptr<!cir.vector<!cir.float x 4>>
82+ // CIR: [[INTRIN_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 4>>, !cir.vector<!cir.float x 4>
83+ // CIR: [[INTRIN_ARG_CAST:%.*]] = cir.cast(bitcast, [[INTRIN_ARG]] : !cir.vector<!cir.float x 4>), !cir.vector<!s8i x 16>
84+ // CIR: [[INTRIN_ARG_BACK:%.*]] = cir.cast(bitcast, [[INTRIN_ARG_CAST]] : !cir.vector<!s8i x 16>), !cir.vector<!cir.float x 4>
85+ // CIR: {{%.*}} = cir.llvm.intrinsic "llvm.round" [[INTRIN_ARG_BACK]] : (!cir.vector<!cir.float x 4>) -> !cir.vector<!cir.float x 4>
86+ // CIR: cir.return {{%.*}} : !cir.vector<!cir.float x 4>
87+
88+ // LLVM: define dso_local <4 x float> @test_vrndaq_f32(<4 x float> [[ARG:%.*]])
89+ // LLVM: store <4 x float> [[ARG]], ptr [[ARG_SAVE:%.*]], align 16
90+ // LLVM: [[P0:%.*]] = load <4 x float>, ptr [[ARG_SAVE]], align 16,
91+ // LLVM: store <4 x float> [[P0]], ptr [[P0_SAVE:%.*]], align 16,
92+ // LLVM: [[INTRIN_ARG:%.*]] = load <4 x float>, ptr [[P0_SAVE]], align 16,
93+ // LLVM: [[INTRIN_RES:%.*]] = call <4 x float> @llvm.round.v4f32(<4 x float> [[INTRIN_ARG]])
94+ // LLVM: store <4 x float> [[INTRIN_RES]], ptr [[RES_SAVE0:%.*]], align 16,
95+ // LLVM: [[RES_COPY0:%.*]] = load <4 x float>, ptr [[RES_SAVE0]], align 16,
96+ // LLVM: store <4 x float> [[RES_COPY0]], ptr [[RES_SAVE1:%.*]], align 16,
97+ // LLVM: [[RES_COPY1:%.*]] = load <4 x float>, ptr [[RES_SAVE1]], align 16,
98+ // LLVM: store <4 x float> [[RES_COPY1]], ptr [[RET_P:%.*]], align 16,
99+ // LLVM: [[RET_VAL:%.*]] = load <4 x float>, ptr [[RET_P]], align 16,
100+ // LLVM: ret <4 x float> [[RET_VAL]]
0 commit comments