aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/pr41027.c
blob: c16e232931c01bfcf112bbeafa7eaf5a5984df4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -O2 -o - %s | FileCheck %s

// CHECK-LABEL: f:
// CHECK:         movl $1, %eax
// CHECK-NEXT:    #APP
// CHECK-NEXT:    outl %eax, $1
// CHECK-NEXT:    #NO_APP

static inline void pr41027(unsigned a, unsigned b) {
  if (__builtin_constant_p(a)) {
    __asm__ volatile("outl %0,%w1" : : "a"(b), "n"(a));
  } else {
    __asm__ volatile("outl %0,%w1" : : "a"(b), "d"(a));
  }
}

void f(unsigned port) {
  pr41027(1, 1);
}