aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/X86/ioport.llx
blob: 8f09aa21049db3a4b68c24051cfa646a65d3c7ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
; RUN: llvm-as < %s | llc -march=x86

implementation

declare int %llvm.readport (ushort)
declare void %llvm.writeport (int, ushort)

int %in(ushort %p) {
  %i1 = call int %llvm.readport (ushort 255)
  %i2 = call int %llvm.readport (ushort %p)
  %r = add int %i1, %i2
  ret int %r
}


void %out(ushort %p) {
  call void(int, ushort)* %llvm.writeport (int 1, ushort 255)
  call void(int, ushort)* %llvm.writeport (int 4, ushort %p)
  ret void
}