I don't believe the G6 ever came with a 3.8. The 2007 GTP I think has the 3.6l DOHC engine. GM's high feature V6 engine. It produces quite a bit more power then the 3.5
The 3.5 is also a pushrod engine while the 3.6 has dual over head cams on each bank.
That being said, the GTP ecu won't directly run the 3.5, There's more sensor and I think even variable valve timing. Swapping the engine in would likely require swapping the computers and harness and getting them flashed to match the VIN with the BCM.