Skip to content

Commit ac53a36

Browse files
committed
address comments
1 parent f25c41e commit ac53a36

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ static mlir::Value getMaskVecValue(CIRGenBuilderTy &builder, mlir::Location loc,
8989
}
9090

9191
static mlir::Value emitX86FunnelShift(CIRGenFunction &cgf,
92-
const mlir::Location &location,
93-
mlir::Value &op0, mlir::Value &op1,
94-
mlir::Value &amt, bool isRight) {
92+
mlir::Location location, mlir::Value &op0,
93+
mlir::Value &op1, mlir::Value &amt,
94+
bool isRight) {
9595
CIRGenBuilderTy &builder = cgf.getBuilder();
9696
mlir::Type op0Ty = op0.getType();
9797

clang/test/CIR/CodeGenBuiltins/X86/avx512f-builtins.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,30 @@ __m512i test_mm512_undefined_epi32(void) {
7979
}
8080

8181
__m512i test_mm512_ror_epi32(__m512i __A) {
82-
// CHECK-LABEL: test_mm512_ror_epi32
83-
// CHECK: @llvm.fshr.v16i32
82+
// CIR-LABEL: test_mm512_ror_epi32
83+
// CIR: {{%.*}} = cir.cast integral {{%.*}} : !s32i -> !u32i
84+
// CIR: {{%.*}} = cir.vec.splat {{%.*}} : !u32i, !cir.vector<16 x !u32i>
85+
// CIR: {{%.*}} = cir.call_llvm_intrinsic "fshr" {{%.*}}: (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
86+
// LLVM-LABEL: test_mm512_ror_epi32
87+
// LLVM: %[[CASTED_VAR:.*]] = bitcast <8 x i64> {{%.*}} to <16 x i32>
88+
// LLVM: {{%.*}} = call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %[[CASTED_VAR]], <16 x i32> %[[CASTED_VAR]], <16 x i32> splat (i32 5))
89+
// OGCG-LABEL: test_mm512_ror_epi32
90+
// OGCG: %[[CASTED_VAR:.*]] = bitcast <8 x i64> {{%.*}} to <16 x i32>
91+
// OGCG: {{%.*}} = call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %[[CASTED_VAR]], <16 x i32> %[[CASTED_VAR]], <16 x i32> splat (i32 5))
8492
return _mm512_ror_epi32(__A, 5);
8593
}
8694

8795
__m512i test_mm512_ror_epi64(__m512i __A) {
88-
// CHECK-LABEL: test_mm512_ror_epi64
89-
// CHECK: @llvm.fshr.v8i64
96+
// CIR-LABEL: test_mm512_ror_epi64
97+
// CIR: {{%.*}} = cir.cast integral {{%.*}} : !s32i -> !u32i
98+
// CIR: {{%.*}} = cir.cast integral {{%.*}} : !u32i -> !u64i
99+
// CIR: {{%.*}} = cir.vec.splat {{%.*}} : !u64i, !cir.vector<8 x !u64i>
100+
// CIR: {{%.*}} = cir.call_llvm_intrinsic "fshr" {{%.*}}: (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
101+
// LLVM-LABEL: test_mm512_ror_epi64
102+
// LLVM: %[[VAR:.*]] = load <8 x i64>, ptr {{%.*}}, align 64
103+
// LLVM: {{%.*}} = call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %[[VAR]], <8 x i64> %[[VAR]], <8 x i64> splat (i64 5))
104+
// OGCG-LABEL: test_mm512_ror_epi64
105+
// OGCG: %[[VAR:.*]] = load <8 x i64>, ptr {{%.*}}, align 64
106+
// OGCG: {{%.*}} = call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %[[VAR]], <8 x i64> %[[VAR]], <8 x i64> splat (i64 5))
90107
return _mm512_ror_epi64(__A, 5);
91108
}

clang/test/CodeGen/X86/xop-builtins.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,3 +429,10 @@ __m256d test_mm256_frcz_pd(__m256d a) {
429429
// CHECK: call {{.*}}<4 x double> @llvm.x86.xop.vfrcz.pd.256(<4 x double> %{{.*}})
430430
return _mm256_frcz_pd(a);
431431
}
432+
433+
434+
__m512i test_mm512_ror_epi32(__m512i __A) {
435+
// CHECK-LABEL: test_mm512_ror_epi32
436+
// CHECK: @llvm.fshr.v16i32
437+
return _mm512_ror_epi32(__A, 5);
438+
}

0 commit comments

Comments
 (0)