Repository: pytorch
Issue: internal compiler error: in extract_insn when compiling pytorch with xpu with gcc 12
Labels: triaged,module: xpu

### 🐛 Describe the bug

As title, compilation with XPU support fails with the issue below. Compiling CPU succeeds.

```
...
/opt/intel/oneapi/compiler/2025.0/bin/compiler/../../include/sycl/detail/builtins/builtins.hpp:235:1: warning: multi-line comment [-Wcomment]
  235 | // clang++ -[DU]__SYCL_DEVICE_ONLY__ -x c++ math_functions.inc  \
      | ^
In file included from /usr/include/c++/12/functional:59,
                 from /root/pytorch/c10/util/string_view.h:6,
                 from /root/pytorch/c10/util/StringUtil.h:6,
                 from /root/pytorch/c10/util/Exception.h:8,
                 from /root/pytorch/aten/src/ATen/BlasBackend.h:3,
                 from /root/pytorch/aten/src/ATen/Context.h:3:
/usr/include/c++/12/bits/std_function.h: In static member function ~@~Xstatic _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const sstd::_Any_data&, _ArgTypes&& ...) [with _Res = void; _Functor = sycl::_V1::handler::ResetHostKernel<at::native::xpu::VectorizedElementwiseKernel<8, at::native::xpu::SignbitFunctor<c10::BFloat16>, at::detail::Array<char*, 2>, TrivialOffsetCalculator<1, unsigned int> >, sycl::_V1::nd_item<1>, 1>(const at::native::xpu::VectorizedElementwiseKernel<8, at::native::xpu::SignbitFunctor<c10::BFloat16>, at::detail::Array<char*, 2>, TrivialOffsetCalculator<1, unsigned int> >&)::NormalizedKernelType; _ArgTypes = {const sycl::_V1::nd_item<1>&}]~@~Y:
/usr/include/c++/12/bits/std_function.h:292:7: error: unrecognizable insn:
  292 |       }
      |       ^
(insn 21 20 22 4 (set (reg:V2SI 87 [ vect__71.47795 ])
        (lshiftrt:V2SI (subreg:V2SI (subreg:V2SF (reg:V2SI 118 [ vect__69.47793 ]) 0) 0)
            (const_int 31 [0x1f]))) "/usr/include/c++/12/cmath":662:29 -1
     (nil))
during RTL pass: vregs
/usr/include/c++/12/bits/std_function.h:292:7: internal compiler error: in extract_insn, at recog.cc:2791
0x1b3ed3a internal_error(char const*, ...)
        ???:0
0x6a22ba fancy_abort(char const*, int, char const*)
        ???:0
0x67affc _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
        ???:0
0x67b01e _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
CMake Error at torch_xpu_ops_sycl_unary_binary_kernels_generated_UnarySignKernels.cpp.o.Release.cmake:145 (message):
  Error generating file
  /root/pytorch/build/caffe2/aten_xpu/src/CMakeFiles/torch_xpu_ops_sycl_unary_binary_kernels.dir/ATen/native/xpu/sycl/./torch_xpu_ops_sycl_unary_binary_kernels_generated_UnarySignKernels.cpp.o
...
```

### Versions

```
(xpu) root@2649cb81ee38:~# python collect_env.py
Collecting environment information...

OS: Ubuntu 22.04.5 LTS (x86_64)
GCC version: (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
Clang version: Could not collect
CMake version: version 3.31.4
Libc version: glibc-2.35                                                                                                                                                                                                                                                                                                Python version: 3.10.16 | packaged by conda-forge | (main, Dec  5 2024, 14:16:10) [GCC 13.3.0] (64-bit runtime)
Intel GPU driver version:
* intel_opencl: 24.45.31740.15-1057~22.04
* level_zero:   1.18.5.0-1055~22.04
```

cc @gujinghui @EikanWang @fengyuan14 @guangyey