I came across a bug in the generated code for SystemZ target when accessing thread_local variables in functions that have 7 or more parameters.
The problem can be seen here
while extracting the values from AR0 and AR1
ear %r0, %a0 ; copy AR0 to GR0L risblg %r14, %r0, 0, 159, 32 <<<<<<<< copy GR0H to GR14L sllg %r14, %r14, 32 ear %r0, %a1 risblg %r14, %r0, 0, 159, 32 <<<<<<<< the same issue here
the compiler thinks there is an option to copy the content of access registers into high half of the general purpose register, which is not available on the platform.
Bug report: https://bugs.llvm.org/show_bug.cgi?id=44254