Skip to content

Commit f53280c

Browse files
committed
Address review comments
Signed-off-by: Medha Tiwari <medhatiwari@ibm.com>
1 parent e590a91 commit f53280c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -586,13 +586,11 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
586586
// this mask split into two 32-bit registers: EDX (high 32 bits) and
587587
// EAX (low 32 bits).
588588
mlir::Type i32Ty = builder.getSInt32Ty();
589-
mlir::Type i64Ty = builder.getSInt64Ty();
590589

591590
// Mhi = (uint32_t)(ops[1] >> 32) - extract high 32 bits via right shift
592-
cir::ConstantOp shift32 =
593-
builder.getConstant(loc, cir::IntAttr::get(i64Ty, 32));
594-
mlir::Value mhi =
595-
builder.createShift(loc, ops[1], shift32.getResult(), /*isRight=*/true);
591+
cir::ConstantOp shift32 = builder.getSInt64(32, loc);
592+
mlir::Value mhi = builder.createShift(loc, ops[1], shift32.getResult(),
593+
/*isShiftLeft=*/false);
596594
mhi = builder.createIntCast(mhi, i32Ty);
597595

598596
// Mlo = (uint32_t)ops[1] - extract low 32 bits by truncation

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@
77

88
void test_xsave(void *p, unsigned long long m) {
99
// CIR-LABEL: test_xsave
10+
// CIR: cir.const #cir.int<32> : !s64i
11+
// CIR: cir.shift(right, {{.*}} : !u64i, {{.*}} : !s64i) -> !u64i
12+
// CIR: cir.cast integral %{{.*}} : !u64i -> !s32i
13+
// CIR: cir.cast integral %{{.*}} : !u64i -> !s32i
1014
// CIR: cir.call_llvm_intrinsic "x86.xsave"
1115

1216
// LLVM-LABEL: test_xsave
13-
// LLVM: call void @llvm.x86.xsave
17+
// LLVM: lshr i64 {{.*}}, 32
18+
// LLVM: trunc i64 {{.*}} to i32
19+
// LLVM: trunc i64 {{.*}} to i32
20+
// LLVM: call void @llvm.x86.xsave(ptr {{.*}}, i32 {{.*}}, i32 {{.*}})
1421

1522
// OGCG-LABEL: test_xsave
1623
// OGCG: call void @llvm.x86.xsave

0 commit comments

Comments
 (0)