According to C standard, the behaviour of shift for 17888, 255 and 128 is undefined, and compilers give warnings about that. The behaviour of fpc in these cases is unknown. There was a discussion about that:
https://forum.lazarus.freepascal.org/index.php/topic,40340.0.html. In any case you cannot rely on those results.
As for results for 0, 1 and 48, note that in your C code you use %d format, i.e. results are converted to int. If you change your pascal function to return
integer longint (edited for accuracy), results for 64-bit program are:
IntToStr(CACHE_L1_SELECTION_MASK(17888))+LineEnding+ //0 - do not trust!
IntToStr(CACHE_L1_SELECTION_MASK(255))+LineEnding+ //-2 - do not trust!
IntToStr(CACHE_L1_SELECTION_MASK(0))+LineEnding+ //0
IntToStr(CACHE_L1_SELECTION_MASK(1))+LineEnding+ //0
IntToStr(CACHE_L1_SELECTION_MASK(48))+LineEnding+ //-65536
IntToStr(CACHE_L1_SELECTION_MASK(128))+LineEnding); //0 - do not trust!
what corresponds to your C results for those arguments, which we can trust.
And if you change format to %lld in C code, you'll get for 64-bit program
printf("CACHE_L1_SELECTION_MASK %lld \n", CACHE_L1_SELECTION_MASK
(17888)); //-1 - undefined! printf("CACHE_L1_SELECTION_MASK %lld \n", CACHE_L1_SELECTION_MASK
(255)); //-1 - undefined! printf("CACHE_L1_SELECTION_MASK %lld \n", CACHE_L1_SELECTION_MASK
(0)); //0 printf("CACHE_L1_SELECTION_MASK %lld \n", CACHE_L1_SELECTION_MASK
(1)); //-9223372036854775808 printf("CACHE_L1_SELECTION_MASK %lld \n", CACHE_L1_SELECTION_MASK
(48)); //-65536 printf("CACHE_L1_SELECTION_MASK %lld \n", CACHE_L1_SELECTION_MASK
(128)); //-1 - undefined!
what corresponds to your pascal results for those arguments, for which the behaviour is defined.