aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/cmov/cmov.c
blob: 2e3888343f44d581f0c97c56d73465ae896e794e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>

long cmovl(int x, long y, long z) {
  return __builtin_sel(x, y, z);
}

int cmovi(int x, int y, int z) {
  return __builtin_sel(x, y, z);
}

double cmovd(int x, double y, double z) {
  return __builtin_sel(x, y, z);
}

int main() {
  printf("%ld\n", cmovl(1, 42, 65));
  printf("%ld\n", cmovl(0, 42, 65));
  printf("%d\n", cmovi(1, 42, 65));
  printf("%d\n", cmovi(0, 42, 65));
  printf("%f\n", cmovd(1, 42., 65.));
  printf("%f\n", cmovd(0, 42., 65.));
}