1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-apple-darwin -mcpu=knl --show-mc-encoding -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,X86
3; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl --show-mc-encoding -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,X64
4
5declare i32 @llvm.x86.rdpkru()
6declare void @llvm.x86.wrpkru(i32)
7
8define void @test_x86_wrpkru(i32 %src) {
9; X86-LABEL: test_x86_wrpkru:
10; X86:       ## %bb.0:
11; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
12; X86-NEXT:    xorl %edx, %edx ## encoding: [0x31,0xd2]
13; X86-NEXT:    xorl %ecx, %ecx ## encoding: [0x31,0xc9]
14; X86-NEXT:    wrpkru ## encoding: [0x0f,0x01,0xef]
15; X86-NEXT:    retl ## encoding: [0xc3]
16;
17; X64-LABEL: test_x86_wrpkru:
18; X64:       ## %bb.0:
19; X64-NEXT:    movl %edi, %eax ## encoding: [0x89,0xf8]
20; X64-NEXT:    xorl %edx, %edx ## encoding: [0x31,0xd2]
21; X64-NEXT:    xorl %ecx, %ecx ## encoding: [0x31,0xc9]
22; X64-NEXT:    wrpkru ## encoding: [0x0f,0x01,0xef]
23; X64-NEXT:    retq ## encoding: [0xc3]
24  call void @llvm.x86.wrpkru(i32 %src)
25  ret void
26}
27
28define i32 @test_x86_rdpkru() {
29; CHECK-LABEL: test_x86_rdpkru:
30; CHECK:       ## %bb.0:
31; CHECK-NEXT:    xorl %ecx, %ecx ## encoding: [0x31,0xc9]
32; CHECK-NEXT:    rdpkru ## encoding: [0x0f,0x01,0xee]
33; CHECK-NEXT:    ret{{[l|q]}} ## encoding: [0xc3]
34  %res = call i32 @llvm.x86.rdpkru()
35  ret i32 %res
36}
37