• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=+ptwrite | FileCheck %s --check-prefix=X86
3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+ptwrite | FileCheck %s --check-prefix=X86_64
4
5define void @test_ptwrite(i32 %value) {
6; X86-LABEL: test_ptwrite:
7; X86:       # %bb.0: # %entry
8; X86-NEXT:    ptwritel {{[0-9]+}}(%esp)
9; X86-NEXT:    retl
10;
11; X86_64-LABEL: test_ptwrite:
12; X86_64:       # %bb.0: # %entry
13; X86_64-NEXT:    ptwritel %edi
14; X86_64-NEXT:    retq
15entry:
16  call void @llvm.x86.ptwrite32(i32 %value)
17  ret void
18}
19
20define void @test_ptwrite2(i32 %x) {
21; X86-LABEL: test_ptwrite2:
22; X86:       # %bb.0: # %entry
23; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
24; X86-NEXT:    incl %eax
25; X86-NEXT:    ptwritel %eax
26; X86-NEXT:    retl
27;
28; X86_64-LABEL: test_ptwrite2:
29; X86_64:       # %bb.0: # %entry
30; X86_64-NEXT:    incl %edi
31; X86_64-NEXT:    ptwritel %edi
32; X86_64-NEXT:    retq
33entry:
34  %value = add i32 %x, 1
35  call void @llvm.x86.ptwrite32(i32 %value)
36  ret void
37}
38
39define void @test_ptwrite32p(i32* %pointer) {
40; X86-LABEL: test_ptwrite32p:
41; X86:       # %bb.0: # %entry
42; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
43; X86-NEXT:    ptwritel (%eax)
44; X86-NEXT:    retl
45;
46; X86_64-LABEL: test_ptwrite32p:
47; X86_64:       # %bb.0: # %entry
48; X86_64-NEXT:    ptwritel (%rdi)
49; X86_64-NEXT:    retq
50entry:
51  %value = load i32, i32* %pointer, align 4
52  call void @llvm.x86.ptwrite32(i32 %value)
53  ret void
54}
55
56declare void @llvm.x86.ptwrite32(i32)
57