[clang] [X86] Add support for MS inp functions. (PR #93804)
Phoebe Wang via cfe-commits
cfe-commits at lists.llvm.org
Thu May 30 07:47:18 PDT 2024
================
@@ -63,6 +63,47 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) {
// CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]]
// CHECK: ret i64 [[RES]]
+
+int test_inp(unsigned short port) {
+ return _inp(port);
+}
+// CHECK-LABEL: i32 @test_inp(i16 noundef
+// CHECK-SAME: [[PORT:%.*]])
+// CHECK: [[TMP0:%.*]] = tail call i32 asm sideeffect "inb ${1:b}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]])
+// CHECK-NEXT: ret i32 [[TMP0]]
+
+unsigned short test_inpw(unsigned short port) {
+ return _inpw(port);
+}
+// CHECK-LABEL: i16 @test_inpw(i16 noundef
+// CHECK-SAME: [[PORT:%.*]])
+// CHECK: [[TMP0:%.*]] = tail call i16 asm sideeffect "inw ${1:w}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]])
+// CHECK-NEXT: ret i16 [[TMP0]]
+
+unsigned long test_inpd(unsigned short port) {
+ return _inpd(port);
+}
+// CHECK-LABEL: i32 @test_inpd(i16 noundef
+// CHECK-SAME: [[PORT:%.*]])
+// CHECK: [[TMP0:%.*]] = tail call i32 asm sideeffect "inl ${1:k}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]])
----------------
phoebewang wrote:
Shouldn't it be `={eax}` for 32-bit?
https://github.com/llvm/llvm-project/pull/93804
More information about the cfe-commits
mailing list