brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.5 KiB · 937c1ea Raw
223 lines · c
1// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -triple aarch64 %s2 3void string_literal(unsigned v) {4  __builtin_arm_wsr(0, v); // expected-error {{expression is not a string literal}}5}6 7void wsr_1(unsigned v) {8  __builtin_arm_wsr("sysreg", v);9}10 11void wsrp_1(void *v) {12  __builtin_arm_wsrp("sysreg", v);13}14 15void wsr64_1(unsigned long v) {16  __builtin_arm_wsr64("sysreg", v);17}18 19void wsr128_1(__uint128_t v) {20  __builtin_arm_wsr128("sysreg", v);21}22 23unsigned rsr_1(void) {24  return __builtin_arm_rsr("sysreg");25}26 27void *rsrp_1(void) {28  return __builtin_arm_rsrp("sysreg");29}30 31unsigned long rsr64_1(void) {32  return __builtin_arm_rsr64("sysreg");33}34 35__uint128_t rsr128_1(void) {36  return __builtin_arm_rsr128("sysreg");37}38 39void wsr_2(unsigned v) {40  __builtin_arm_wsr("0:1:2:3:4", v);41}42 43void wsrp_2(void *v) {44  __builtin_arm_wsrp("0:1:2:3:4", v);45}46 47void wsr64_2(unsigned long v) {48  __builtin_arm_wsr64("0:1:2:3:4", v);49}50 51unsigned rsr_2(void) {52  return __builtin_arm_rsr("0:1:15:15:4");53}54 55void *rsrp_2(void) {56  return __builtin_arm_rsrp("0:1:2:3:4");57}58 59unsigned long rsr64_2(void) {60  return __builtin_arm_rsr64("0:1:15:15:4");61}62 63__uint128_t rsr128_2(void) {64  return __builtin_arm_rsr128("0:1:15:15:4");65}66 67void wsr_3(unsigned v) {68  __builtin_arm_wsr("0:1:2", v); //expected-error {{invalid special register for builtin}}69}70 71void wsrp_3(void *v) {72  __builtin_arm_wsrp("0:1:2", v); //expected-error {{invalid special register for builtin}}73}74 75void wsr64_3(unsigned long v) {76  __builtin_arm_wsr64("0:1:2", v); //expected-error {{invalid special register for builtin}}77}78 79void wsr128_3(__uint128_t v) {80  __builtin_arm_wsr128("0:1:2", v); //expected-error {{invalid special register for builtin}}81}82 83unsigned rsr_3(void) {84  return __builtin_arm_rsr("0:1:2"); //expected-error {{invalid special register for builtin}}85}86 87unsigned rsr_4(void) {88  return __builtin_arm_rsr("0:1:2:3:8"); //expected-error {{invalid special register for builtin}}89}90 91unsigned rsr_5(void) {92  return __builtin_arm_rsr("0:8:1:2:3"); //expected-error {{invalid special register for builtin}}93}94 95unsigned rsr_6(void) {96  return __builtin_arm_rsr("0:1:16:16:2"); //expected-error {{invalid special register for builtin}}97}98 99void *rsrp_3(void) {100  return __builtin_arm_rsrp("0:1:2"); //expected-error {{invalid special register for builtin}}101}102 103unsigned long rsr64_3(void) {104  return __builtin_arm_rsr64("0:1:2"); //expected-error {{invalid special register for builtin}}105}106 107unsigned long rsr64_4(void) {108  return __builtin_arm_rsr64("0:1:2:3:8"); //expected-error {{invalid special register for builtin}}109}110 111unsigned long rsr64_5(void) {112  return __builtin_arm_rsr64("0:8:2:3:4"); //expected-error {{invalid special register for builtin}}113}114 115unsigned long rsr64_6(void) {116  return __builtin_arm_rsr64("0:1:16:16:2"); //expected-error {{invalid special register for builtin}}117}118 119void rsr64_7(unsigned long *r) {120  // The following three instructions should produce the same assembly.121  r[0] = __builtin_arm_rsr64("ICC_CTLR_EL3");122  r[1] = __builtin_arm_rsr64("s3_6_c12_c12_4");123  r[2] = __builtin_arm_rsr64("3:6:12:12:4");124}125 126__uint128_t rsr128_3(void) {127  return __builtin_arm_rsr128("0:1:2"); //expected-error {{invalid special register for builtin}}128}129 130__uint128_t rsr128_4(void) {131  return __builtin_arm_rsr128("0:1:2:3:8"); //expected-error {{invalid special register for builtin}}132}133 134__uint128_t rsr128_5(void) {135  return __builtin_arm_rsr128("0:8:2:3:4"); //expected-error {{invalid special register for builtin}}136}137 138__uint128_t rsr128_6(void) {139  return __builtin_arm_rsr128("0:1:16:16:2"); //expected-error {{invalid special register for builtin}}140}141 142void wsr_4(void) {143  __builtin_arm_wsr("spsel", 15);144  __builtin_arm_wsr("daifclr", 15);145  __builtin_arm_wsr("daifset", 15);146  __builtin_arm_wsr("pan", 15);147  __builtin_arm_wsr("uao", 15);148  __builtin_arm_wsr("dit", 15);149  __builtin_arm_wsr("ssbs", 15);150  __builtin_arm_wsr("tco", 15);151 152  __builtin_arm_wsr("allint", 1);153  __builtin_arm_wsr("pm", 1);154}155 156void wsr64_4(void) {157  __builtin_arm_wsr("spsel", 15);158  __builtin_arm_wsr("daifclr", 15);159  __builtin_arm_wsr("daifset", 15);160  __builtin_arm_wsr("pan", 15);161  __builtin_arm_wsr("uao", 15);162  __builtin_arm_wsr("dit", 15);163  __builtin_arm_wsr("ssbs", 15);164  __builtin_arm_wsr("tco", 15);165 166  __builtin_arm_wsr("allint", 1);167  __builtin_arm_wsr("pm", 1);168}169 170void wsr_5(unsigned v) {171  __builtin_arm_wsr("spsel", v); // expected-error {{must be a constant integer}}172  __builtin_arm_wsr("daifclr", v); // expected-error {{must be a constant integer}}173  __builtin_arm_wsr("daifset", v); // expected-error {{must be a constant integer}}174  __builtin_arm_wsr("pan", v); // expected-error {{must be a constant integer}}175  __builtin_arm_wsr("uao", v); // expected-error {{must be a constant integer}}176  __builtin_arm_wsr("dit", v); // expected-error {{must be a constant integer}}177  __builtin_arm_wsr("ssbs", v); // expected-error {{must be a constant integer}}178  __builtin_arm_wsr("tco", v); // expected-error {{must be a constant integer}}179  __builtin_arm_wsr("allint", v); // expected-error {{must be a constant integer}}180  __builtin_arm_wsr("pm", v); // expected-error {{must be a constant integer}}181}182 183void wsr64_5(unsigned long v) {184  __builtin_arm_wsr64("spsel", v); // expected-error {{must be a constant integer}}185  __builtin_arm_wsr64("daifclr", v); // expected-error {{must be a constant integer}}186  __builtin_arm_wsr64("daifset", v); // expected-error {{must be a constant integer}}187  __builtin_arm_wsr64("pan", v); // expected-error {{must be a constant integer}}188  __builtin_arm_wsr64("uao", v); // expected-error {{must be a constant integer}}189  __builtin_arm_wsr64("dit", v); // expected-error {{must be a constant integer}}190  __builtin_arm_wsr64("ssbs", v); // expected-error {{must be a constant integer}}191  __builtin_arm_wsr64("tco", v); // expected-error {{must be a constant integer}}192  __builtin_arm_wsr64("allint", v); // expected-error {{must be a constant integer}}193  __builtin_arm_wsr64("pm", v); // expected-error {{must be a constant integer}}194}195 196void wsr_6(void) {197  __builtin_arm_wsr("spsel", 16); // expected-error {{outside the valid range}}198  __builtin_arm_wsr("daifclr", 16); // expected-error {{outside the valid range}}199  __builtin_arm_wsr("daifset", 16); // expected-error {{outside the valid range}}200  __builtin_arm_wsr("pan", 16); // expected-error {{outside the valid range}}201  __builtin_arm_wsr("uao", 16); // expected-error {{outside the valid range}}202  __builtin_arm_wsr("dit", 16); // expected-error {{outside the valid range}}203  __builtin_arm_wsr("ssbs", 16); // expected-error {{outside the valid range}}204  __builtin_arm_wsr("tco", 16); // expected-error {{outside the valid range}}205 206  __builtin_arm_wsr("allint", 2); // expected-error {{outside the valid range}}207  __builtin_arm_wsr("pm", 2); // expected-error {{outside the valid range}}208}209 210void wsr64_6(void) {211  __builtin_arm_wsr64("spsel", 16); // expected-error {{outside the valid range}}212  __builtin_arm_wsr64("daifclr", 16); // expected-error {{outside the valid range}}213  __builtin_arm_wsr64("daifset", 16); // expected-error {{outside the valid range}}214  __builtin_arm_wsr64("pan", 16); // expected-error {{outside the valid range}}215  __builtin_arm_wsr64("uao", 16); // expected-error {{outside the valid range}}216  __builtin_arm_wsr64("dit", 16); // expected-error {{outside the valid range}}217  __builtin_arm_wsr64("ssbs", 16); // expected-error {{outside the valid range}}218  __builtin_arm_wsr64("tco", 16); // expected-error {{outside the valid range}}219 220  __builtin_arm_wsr64("allint", 2); // expected-error {{outside the valid range}}221  __builtin_arm_wsr64("pm", 2); // expected-error {{outside the valid range}}222}223