Both Tesla and Alphabet signaled higher spending as they invest in artificial intelligence.